inkey(String*); questions....

Posted By: lostclimate

inkey(String*); questions.... - 01/28/10 04:08

I have two questions that seem to not have been asked yet and they address some issues with inkey.

Why does inkey stop mouse clicks? you'd think that you'd have the chance to click somewhere to stop the inkey like if you made a textbox, and wanted to click out of it to stop inkey or to go to a different textbox.

also why does your function freeze completely not allowing you to modify the inkey at all for instance, im making an morpg. when the player logs in he needs to type in his password, but I cant modify the text.pstring to change it to *'s while inkey is going, where i could just freeze it myself in a loop with another function to stop the inkey. that way I can make it a little more functional since I may have to find a different solution for my text boxes, soley because of this issue.
Posted By: FBL

Re: inkey(String*); questions.... - 01/28/10 07:07

Well at least changing text to stars is easy - use a font consisting of stars only.
Posted By: lostclimate

Re: inkey(String*); questions.... - 01/28/10 08:38

with truetype font? making charmap for that would be a pretty glaring workaround. It would work tho........
Posted By: jcl

Re: inkey(String*); questions.... - 01/28/10 08:48

Lite-C is a programming language. So, it's completely up to you how inkey reacts on mouse clicks, or how the entered text is displayed as "*". Just program it in a function that runs while inkey is active. You need no special font, you can just display a different string.

Posted By: lostclimate

Re: inkey(String*); questions.... - 01/28/10 08:59

yes, but inkey freezes its current function, so how ame i suposed to modify any string while people are typing.
Posted By: Joey

Re: inkey(String*); questions.... - 01/28/10 09:14

just do it in some other function.
Posted By: Helghast

Re: inkey(String*); questions.... - 01/28/10 09:49

Code:
var inkeyStore = inkey(tempStr);
while(inkey_active) { // do stuff in here...
   wait(1); 
}



That'll work...
to make *'s out of your field, there's a easy workaround for that I did ages ago.
Read the str_len of the inkey string you pass, and display a 2nd string, created out of *'s, based on the length of the input string...
I'f im unclear with that idea, lemme know, i'll paste my code I made for you laugh

regards,
Posted By: lostclimate

Re: inkey(String*); questions.... - 01/28/10 09:55

thank you so much Helghast. who'da thought the most annoying part of programming an mmorpg (or just a morpg for that matter) would be the string manipulation. I have anet and GSTsqlite integrated, up and running where clients log on and chat, and so far 90% of my issues were related to string manipulation and being able to tell what was a pointer, char array, or whether or not it was global... frown
Posted By: Helghast

Re: inkey(String*); questions.... - 01/28/10 10:07

I disagree, once familiar with the string manipulation functions, these are the most powerfull tools you'll get in scripting.

again, if you need help, lemme know, i've quite alot of string manipulation experience (been doing that since early A6... lol)

regards,
Posted By: lostclimate

Re: inkey(String*); questions.... - 01/28/10 10:18

while i agree that its powerful (basically can be used to send data of any type) it still frustrates me because its hard to figure out which is needed, string, char array, or string pointer.
Posted By: jcl

Re: inkey(String*); questions.... - 01/28/10 10:31

Just use strings. Chars and char arrays are for those experts - if they are too hard to figure, you most likely won't need them.
Posted By: Locoweed

Re: inkey(String*); questions.... - 02/04/10 04:27

Originally Posted By: jcl
Lite-C is a programming language.


That's debatable, lol. (I am just kidding, so don't get angry with me)

Don't let those strings kick your butt lostclimate.
Posted By: GorNaKosh

Re: inkey(String*); questions.... - 03/28/10 20:50

I have the similar problem during the last 2 houres so I give this thread a bump. So far I've got it...
Code:
STRING *strLogingPass = "#99";
STRING *strPassHidden= "#99";

TEXT *txt_loginPass = {
	pos_x = 40;
	pos_y = 118;
	layer = 2;
	font = fontStandard;
	strings = 1;
	string (strPassHidden);
}

BOOL checkPass= 0;
void createHiddenPass() {
	while(checkPass== 1) {
		
		var passLen = str_len(strLogingPass);
		var x = 0;
		for(x=0;x<passLen;x++) {
			if(x=0) {
				str_cpy(strPassHidden, '*');
			} else {
				str_cat(strPassHidden, '*');
			}
		}
		
		wait(1);
	}
}

void windowLogin_passIn() {
	
	set(txt_loginPass, SHOW);

	checkPass= 1;
	createHiddenPass();
	var lastkey = inkey(strLogingPass);
	
	checkPass= 0;
	
	if(lastkey == 13) windowLogin_login();
}



This is just one way I've tryed to get that many *'s like the length of the real entered password. Main problem seam to be tha the strings have to be cleared to get the right length values, but then inkey doesn't read the inout anymore. However, I didn't get it work and need a hint to deal with the conversion from the inkey-string to the *'s...

Thx
Gor Na Kosh
Posted By: jcl

Re: inkey(String*); questions.... - 03/29/10 10:47

At a first glance, the code looks alright, although it can probably be done much shorter. I'm not sure what you mean with clearing the strings. But such questions are better answered in the lite-C forum.
© 2024 lite-C Forums