Page 1 of 1

[HELP] - How to make textNumber to "if" - [Possoble or not?]

PostPosted: Mon May 14, 2012 4:30 pm
by bat78
Hello developers ..long days ago i try to make sth like that:
if (score.textNumber==500) {
DestroyActor("EventActor");
}

But it is no results.. if have another way .. maybe with Global Code - Defines or includes or variables..idk. Help me :cry:
reson.png

Re: [HELP] - How to make textNumber to "if" - [Possoble or n

PostPosted: Mon May 14, 2012 7:12 pm
by SuperSonic
I'm not quite sure what your problem is :|

Re: [HELP] - How to make textNumber to "if" - [Possoble or n

PostPosted: Mon May 14, 2012 7:18 pm
by bat78
it cant be -
The script cant make that effect that need..
Ok lets get 1 Normal Actor named - Actor
Lets make him a text - 0000
lets make sth like that:
KeyDown-->"SPACE" (REPEAT) -->Script Editor:
Actor.textNumber=Actor.textNumber+1;

And for now all is ok but:

VIEW-->Draw Actor: if (Actor.textNumber==50) {
ExitGame();
}

But that does not take effect :)
So we press "space" to up the 0000 to 0050 but then..the game do not exit..now can u understand ? :P

Re: [HELP] - How to make textNumber to "if" - [Possoble or n

PostPosted: Mon May 14, 2012 10:13 pm
by skydereign
Don't use textNumber like that. It isn't a normal variable and should not be used like one. Instead, create a separate variable for score, and use that. It should work if you use the same setup, but instead of Actor.textNumber you just use score. Another thing, you might want to use >= instead of just ==, since if you get to 51, that if statement won't trigger.

Re: [HELP] - How to make textNumber to "if" - [Possoble or n

PostPosted: Mon May 14, 2012 10:14 pm
by bat78
what's the code? i cant understand what u mean.. :oops:

Re: [HELP] - How to make textNumber to "if" - [Possoble or n

PostPosted: Mon May 14, 2012 10:17 pm
by skydereign
By what you said it sounds like you already know how to declare variables. So, declare a variable called score (or whatever you want to call it).
skydereign wrote:It should work if you use the same setup, but instead of Actor.textNumber you just use score.

The code you should be able to figure out from my post.

Re: [HELP] - How to make textNumber to "if" - [Possoble or n

PostPosted: Mon May 14, 2012 10:21 pm
by bat78
[*]instead of Actor.textNumber you just use score.

So well: score(var).textNumber ?
thats variable need to define sth function..how then..

Re: [HELP] - How to make textNumber to "if" - [Possoble or n

PostPosted: Mon May 14, 2012 10:25 pm
by skydereign
No... I said to replace Actor.textNumber with the variable name (score).
view -> Key Down Space -> Script Editor
Code: Select all
score=score+1;

view -> Draw Actor -> Script Editor
Code: Select all
if(score==50)
{
    ExitGame();
}

Re: [HELP] - How to make textNumber to "if" - [Possoble or n

PostPosted: Mon May 14, 2012 10:29 pm
by bat78
i know what u mean now..very clever :D
thank u +1