Page 1 of 1

Code help

PostPosted: Wed May 02, 2007 12:10 pm
by Zehper48
well im amking a game, i didnt really expect the code to work because i though somebody here could help me with it
Code: Select all
{
if tincollision=1;
{
useage=1;
{
ChangeAnimation("Event Actor", "minedore", FORWARD);
{
    tinoreno.textNumber=tinoreno.textNumber+1;
{
 
 
 
 
}
}
}
}
}

thats the code i have and useage and tincollision are both variables
when i try this code the error is
Error line 2: Expected (
Error line 2: Undefined type for relational operation

so help plz

PostPosted: Wed May 02, 2007 12:29 pm
by Kodo
Assuming that if the first condition is true you want to perform the other actions...

Code: Select all
if (tincollision==1)
{
 useage=1;
 ChangeAnimation("Event Actor", "minedore", FORWARD);
 tinoreno.textNumber=tinoreno.textNumber+1;
}

It's worth buying a book on the basics or programming, your problem above is mainly syntax of which the basics are fairly similar in most programming languages. The nasty thing is, as with any language if you miss so much as a ; or type something slightly wrong it just wont work, that's just the way computers are ;)

Also, If you want to count something use a variable not an actor, it's more flexable and allows you to use that variable more widely; so the code:

Code: Select all
tinoreno.textNumber=tinoreno.textNumber+1;


may be written in a basic and easily understandable way as:

Code: Select all
count+1;
tinoreno.textNumber = count;


so the final code might be:

Code: Select all
if (tincollision==1)
{
 useage=1;
 ChangeAnimation("Event Actor", "minedore", FORWARD);
 countcoll+1;
 tinoreno.textNumber = countcoll;
}


You'd have to create a new variable called countcoll for the above to work.

PostPosted: Wed May 02, 2007 11:41 pm
by Zehper48
is that how to make a variable = to a textNumber, how do you do that?

PostPosted: Thu May 03, 2007 12:13 am
by pixelpoop
textNumber is used to change the numbers displayed by an actor in game.
so, if you made an actor and changed it to display numbers, this would change what numbers are being displayed.

actorname.textNumber=20;
//makes that actor display "20" during the game.


variable1=actorname.textNumber;
//This makes variable1 equal to 20;

PostPosted: Thu May 03, 2007 8:25 pm
by Zehper48
YES i got my variables working and the other code was working to thank you soo much, i will probaly have more problems soon, i should learn the basic syntax

thx