Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (SBGuy, Quad), 768 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
check for input true/false? #397165
03/15/12 22:18
03/15/12 22:18
Joined: Nov 2009
Posts: 70
Siwler Offline OP
Junior Member
Siwler  Offline OP
Junior Member

Joined: Nov 2009
Posts: 70
I need help guys, please.

How to check input's value if its true(oped the door) or false(do not open door, keep it shoot)

here is my code:
Code:
function display_controlP()

{
     while (key_enter) {wait (1);} // wait until the player releases the enter key
       str_cpy(Pcode_str, "#50"); // reset the input string
       inkey(Pcode_str); //  input control panels code
       reset (controlP_pan, SHOW); // and then let's hide the panel
       if (you == player)
       {
               my.event = NULL; // make the entity insensitive to other collisions with the player (for now)
               controlP_pan.flags |= (TRANSLUCENT | SHOW); // display the image
               while (vec_dist (player.x, my.x) < 100) {wait (1);} // wait until the player moves away from the entity
               my.event = display_controlP; // the entity is sensitive to impacts again
               controlP_pan.flags &= ~SHOW; // hide the image until the player collides with the entity again
       }

}




Honesty will get you far, were dishonesty will get you only so far in life.

Re: check for input true/false? [Re: Siwler] #397166
03/15/12 22:21
03/15/12 22:21
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
give the door.skillXX a value of 1 (true) if it´s opened or 0 (false) if it´s closed...
and ask for that ._.


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: check for input true/false? [Re: Espér] #397169
03/15/12 23:10
03/15/12 23:10
Joined: Nov 2009
Posts: 70
Siwler Offline OP
Junior Member
Siwler  Offline OP
Junior Member

Joined: Nov 2009
Posts: 70
Hmm, I'm not shore that giving the door.skillXX a value of 1 (true) if it´s opened or 0 (false) if it´s closed... is something that I'm looking for.

Maybe I was not clear enough, let me try this again:

How do I scan for correct imputed value, for example:
Control panels correct value is 123 but if player enters 321 and presses enter key, door will not open, so player has to figure out the correct value which is 123 and enter 123 in to oped the door.

How do I code to scan for correct input value?


Honesty will get you far, were dishonesty will get you only so far in life.

Re: check for input true/false? [Re: Siwler] #397178
03/16/12 07:55
03/16/12 07:55
Joined: Nov 2011
Posts: 274
de
lemming Offline
Member
lemming  Offline
Member

Joined: Nov 2011
Posts: 274
de
Are you looking for str_cmp()?

Re: check for input true/false? [Re: lemming] #397179
03/16/12 08:05
03/16/12 08:05
Joined: Jul 2007
Posts: 424
EUROPE
maslone1 Offline
Senior Member
maslone1  Offline
Senior Member

Joined: Jul 2007
Posts: 424
EUROPE
@siwler

your answere is in your question
if you work with values a "if (value1 == value2) { check=true; } else {check = false; }" is enough
So it is that what Esper already wrote you.


A8c, Blender, FlStudio, Unity3d
Re: check for input true/false? [Re: Siwler] #397180
03/16/12 08:24
03/16/12 08:24
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
As i understand you want combination lock, on entering correct combination door opens rite? You could do this graphicly instead of keys .. Any one ever playd risen. Or could have 3 boxes that take one key input of numbers called a b c and compare to preset values d e f


Compulsive compiler
Re: check for input true/false? [Re: lemming] #397246
03/16/12 21:07
03/16/12 21:07
Joined: Nov 2009
Posts: 70
Siwler Offline OP
Junior Member
Siwler  Offline OP
Junior Member

Joined: Nov 2009
Posts: 70
Originally Posted By: lemming
Are you looking for str_cmp()?


Yes thank you, srt_cmp(); is what i was looking for.
I kind of needed example of how str_cmp worked,
I'll have a sting1 value preset inside the code and check inputted string2 value with string1 if its true/false.



Honesty will get you far, were dishonesty will get you only so far in life.

Re: check for input true/false? [Re: Siwler] #397251
03/16/12 21:55
03/16/12 21:55
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Quote:

I kind of needed example of how str_cmp worked


--> manual ?!!

Re: check for input true/false? [Re: Widi] #397252
03/16/12 22:25
03/16/12 22:25
Joined: Nov 2009
Posts: 70
Siwler Offline OP
Junior Member
Siwler  Offline OP
Junior Member

Joined: Nov 2009
Posts: 70
Originally Posted By: Widi
Quote:

I kind of needed example of how str_cmp worked


--> manual ?!!


I love it when people leave pointless comments. laugh

I have a manual opened 24/7, if I fully understood how str_cmp worked for my complexity of code I wouldn't ask for any help.

But again any comment is appreciated and welcome here, Thank You Widi.

Remember I'm still new to coding, "Please" guys be patient with me.


Honesty will get you far, were dishonesty will get you only so far in life.

Re: check for input true/false? [Re: Siwler] #397254
03/16/12 23:26
03/16/12 23:26
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
What do you not understand or find in the manual?
You have two strings as you said, string1 in your code with a given value and one for the inkey:

STRING* string1 = "1234";
STRING* string2 = "#4"; // String for the inkey
...

after the inkey you can compare this two strings:

if(str_cmp(string1,string2))
{
... // this code runs if string1 = string2
}


Last edited by Widi; 03/16/12 23:28.
Page 1 of 2 1 2

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