Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Quad, 1 invisible), 927 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Empty Strings that will fill with inkey. #319631
04/16/10 10:03
04/16/10 10:03
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
Hi there,

i got a problem. Maybe it is extrem easy and i just dont get it or it is more complicated.

At the moment i´m creating a login system. It is very simple and just .txt layered.

The first thing i do is create my Strings.

Code:
STRING* id_input = "#10";
STRING* pw_input = "#10";



The i have my input field with inkey function, a login and a register button.

Now what i want is. If player press the register button it should check if mininum 3 characters are typed in. That does not work because my strings are already 10 characters longs even if they dont have any characters in it.

This depends on the "#10" after string creation. So everytime i click register it checks the inputs and says: "yes theres is more than 3 characters." But there isnt. laugh

This is the check code.

Code:
input_check = str_len(id_input);

if(input_check > 2)
{
	// Write ID Data
}
else
{
	error("ID need at least 3 characters.");
}



If i create my strings with this one: ""

I just have one character to type in with inkey.

Now how can i manage it that my strings are all 1 character long as long as there is no inkey input?

Re: Empty Strings that will fill with inkey. [Re: Rasch] #319637
04/16/10 10:13
04/16/10 10:13
Joined: Jul 2007
Posts: 53
Germany
Henning Offline
Junior Member
Henning  Offline
Junior Member

Joined: Jul 2007
Posts: 53
Germany
Hi,
at the remarks of the inkey function is this:
The str_cursor function can be used to get the current cursor position while the string is edited.
That should be useful to find the latest cursor position. If more than 2 then O.K. (count starts at 1)

Re: Empty Strings that will fill with inkey. [Re: Henning] #319638
04/16/10 10:18
04/16/10 10:18
Joined: Jun 2008
Posts: 428
Rasch Offline OP
Senior Member
Rasch  Offline OP
Senior Member

Joined: Jun 2008
Posts: 428
Wow what a simple solution didnt see that function yet. It works well. Thank you laugh

Re: Empty Strings that will fill with inkey. [Re: Rasch] #319657
04/16/10 13:42
04/16/10 13:42
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany
But what if the user types in nothing but just moves the cursor three letters to the right? Or what if he types in more than 3 letters, but has to correct the first one, so the cursor end up at the left end? wink

I rather suggest to check if there is a non-space character at the third letter or later.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1