Code help

Non-platform specific questions.

Code help

Postby Zehper48 » Wed May 02, 2007 12:10 pm

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
User avatar
Zehper48
 
Posts: 241
Joined: Sun Jun 11, 2006 1:34 am
Location: Advanced Noob
Score: 4 Give a positive score

Postby Kodo » Wed May 02, 2007 12:29 pm

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.
Last edited by Kodo on Thu May 03, 2007 8:14 am, edited 1 time in total.
Inogames: http://www.inogames.com iOS gaming
Firetop Adventure (app store): http://itunes.apple.com/us/app/firetop- ... ?mt=8&ls=1
User avatar
Kodo
 
Posts: 449
Joined: Thu Oct 20, 2005 8:20 pm
Location: UK
Score: 23 Give a positive score

Postby Zehper48 » Wed May 02, 2007 11:41 pm

is that how to make a variable = to a textNumber, how do you do that?
User avatar
Zehper48
 
Posts: 241
Joined: Sun Jun 11, 2006 1:34 am
Location: Advanced Noob
Score: 4 Give a positive score

Postby pixelpoop » Thu May 03, 2007 12:13 am

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;
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby Zehper48 » Thu May 03, 2007 8:25 pm

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
User avatar
Zehper48
 
Posts: 241
Joined: Sun Jun 11, 2006 1:34 am
Location: Advanced Noob
Score: 4 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest