Inkey questions

Posted By: SurudoiRyu

Inkey questions - 08/18/08 17:36

Hi im using an inkey to put a playername in.
But now im having a white box where the text must come in,
And quest what.. the inkey text is aswell white...
I tryed with vector my.blue and in the panel* blue green red
but it looks like nothing is working to change the color of the inkey text.
Aswell when i want to compare the text with a string it doesn't work. :S
I dont know why but maybe there is a solution to go around this on another way ?

here some of my code:

Inkey code:
Code:
set(entry_txt,VISIBLE);
		inkey(entry_str);
		if (result == 13) 
		{
			level_load ("testlvl.WMB");
			wait(-1);
			
			my = ent_create ("blueguard.mdl",vector(0,0,45),NULL);
			reset(entry_txt,VISIBLE);
			
			reset(Plogin,VISIBLE);
			reset(messages_txt, VISIBLE);
			set(txtChat, VISIBLE);
			set(pSlotbars, VISIBLE); 
			
			Camera_Action();
			Player_Action();
			PlayerHUD();
		}

/////////////////////////////

TEXT* entry_txt = // displays the playername put in
{
	layer = 55;
	pos_x = 10;
	pos_y = 50;
	layer = 10;
	string (entry_str);
}



greetzzz,
Posted By: Lukas

Re: Inkey questions - 08/18/08 17:42

You did not choose a font in your TEXT*, so the default font is used, which is always white.

TEXT* entry_txt =
{
...
font = your_font;
...
red = ... ;
green = ... ;
blue = ... ;
...
}
Posted By: SurudoiRyu

Re: Inkey questions - 08/18/08 18:45

ok got now this:

Code:
TEXT* entry_txt = // displays the playername put in
{
	font = "msgfont.pcx";
	layer = 55;
	pos_x = 10;
	pos_y = 50;
	layer = 10;
	string (entry_str);
	red = 255 ;
	green = 5 ;
	blue = 5 ;
}


but it is still white :S ?
Can it because it is on another layer ?

Code:
PANEL* Plogin = // displays the playername put in
{
	layer = 50;
	bmap = "bmp_login.tga";
	pos_x = 10;
	pos_y = 50;
	layer = 10;
	flags = TRANSLUCENT;
}


greetzzz,
Posted By: Trooper119

Re: Inkey questions - 08/18/08 18:49

Why didn't you look in the manual? It gives the below example

Code:
text welcome // define Text object 
{
  // White Text
  red = 255;
  green = 255;
  blue = 255; 
  font = arial_font;
  string = "Welcome";
}  

Posted By: Lukas

Re: Inkey questions - 08/18/08 18:55

font = "msgfont.pcx";
This is a bitmap font. The colour of this font can't be changed by script, that is only possible with truetype fonts. Actually, if that is the msgfont.pcx from the templates, the text is GREEN.
Anyway, if you use a bitmap font and want to change the colour, open it with a graphic editor and change the colour.

EDIT: I think I wrote too slow laugh
Posted By: MrGuest

Re: Inkey questions - 08/18/08 19:39

afaik you can't change the inkey string colour without editing the image
Posted By: SurudoiRyu

Re: Inkey questions - 08/19/08 10:01

Yes i used the template font.
And its white...
But the pcx is green.
why is it white when the picture font is green?

i gonna try to make it red hope that it helps.

Aswell it looks like the inkey is behind the panel?
but i defined it to be on top of the panel could it be cause i use a half transparant TGA ?
Posted By: SurudoiRyu

Re: Inkey questions - 08/19/08 12:30

solved it smile

PANEL* Plogin = // displays the playername put in
{
layer = 50;
bmap = "bmp_login.tga";
pos_x = 10;
pos_y = 50;
layer = 10;
flags = TRANSLUCENT;
}


that was one problem >.< pretty stupid lol.
Solved aswell the color of the font

but now my other problem is to check if they are the same as another value

Like my inkey is: /search
and my check is to look if you put in /search or not
with a STRING* search_str = "/search";

Code:
STRING* search_str = "/search";

function chat_entry()
{

	// if host or client
	if (connection == 2 || connection == 3)
	{
		// if inkey already open return
		if (inkey_active)	return;
		str_cpy(strChatEntry, "#100");
		set(txtChatEntry,VISIBLE);
		
		inkey(strChatEntry); // get chat entry
		
		// if entry was empty don't process
		if(str_cmp(strChatEntry,""))
		//if(str_len(strChatEntry)==0)
		{
			return;
		}
		reset(txtChatEntry,VISIBLE);
		if(strChatEntry == search_str)
		{
			str_cpy(strSendChat,player_name); // put players name before entry
			str_cat(strSendChat," searches his pockets. ");
		}
		else
		{
			str_cpy(strSendChat,player_name); // put players name before entry
			str_cat(strSendChat,": ");
			str_cat(strSendChat,strChatEntry);
		}
		
		// if Host go ahead and do chat manipulation
		if (connection == 3)
		{
			send_string(strSendChat);
			str_cpy(strChat0, strChat1);
			str_cpy(strChat1, strChat2);
			str_cpy(strChat2, strChat3);
			str_cpy(strChat3, strChat4);
			str_cpy(strChat4, strChat5);
			str_cpy(strChat5, strChat6);
			str_cpy(strChat6, strChat7);
			str_cpy(strChat7, strChat8);
			str_cpy(strChat8, strSendChat);
			str_cpy(strSendChat,"");
		}
		else // if client send entry to server for processing
		{
			send_string(strSendChat);
		}
		str_cpy(strSendChat,"#100"); // clear the strings for client and
		str_cpy(strChatEntry,"#100"); // server called functions
	}
}




greetzzz,


Posted By: DJBMASTER

Re: Inkey questions - 08/19/08 21:39

Hi Ryu, i literally came up with this minutes after you left MSN...

Code:

STRING* temp_string = "                   "; // temp string for inkey
STRING* my_keyword = "/search";              // your chosen search word

function compare_string()
{
if(inkey(temp_string)!=1)
   {
   	if(str_cmp(temp_string,my_keyword)==1){beep(); beep();}
   }
}



This will compare what you enter using the keyboard with a predefined string. If it matches, the engine will beep twice.
Mod it to your purposes...David
Posted By: Neurosys

Re: Inkey questions - 10/12/08 20:44

um... trying to use this inkey in c++ w/ SDK .... inkey isnt a known identifier... wth? no inkey for c++ guys
Posted By: Ralph

Re: Inkey questions - 10/12/08 21:00

In C++ you have to use "cin" and not inkey...
Google it and you will get hundrets of results about it.

Ralph
© 2024 lite-C Forums