Need help with if statement

Started by Chicky, Fri 11/06/2004 21:31:38

Previous topic - Next topic

Chicky

hey I'm having some trouble with this:

// room script file

#sectionstart hotspot1_a  // DO NOT EDIT OR REMOVE THIS LINE
function hotspot1_a() {
  // script for hotspot1: Any click on hotspot, bullet counter
//12
If (GetObjectGraphic(0)==6)
    { SetObjectGraphic(0,7)}
   
//11
   
If (GetObjectGraphic(0)==7)
    { SetObjectGraphic(0,8)}
//10

If (GetObjectGraphic(0)==8)
    { SetObjectGraphic(0,9)}
//9   

If (GetObjectGraphic(0)==9)
    { SetObjectGraphic(0,10)}
   
//8
If (GetObjectGraphic(0)==10)
    { SetObjectGraphic(0,11)}
//7

If (GetObjectGraphic(0)==11)
    { SetObjectGraphic(0,12)}
   
//6
If (GetObjectGraphic(0)==12)
    { SetObjectGraphic(0,13)}
   
    //5
   
   
If (GetObjectGraphic(0)==13)
    { SetObjectGraphic(0,14)}
   
    //4
   
If (GetObjectGraphic(0)==15)
    { SetObjectGraphic(0,16)}
   
    //3
   
If (GetObjectGraphic(0)==16)
    { SetObjectGraphic(0,17)}
   
    //2
   
If (GetObjectGraphic(0)==17)
    { SetObjectGraphic(0,18)}
   
    //1
   
If (GetObjectGraphic(0)==18)
    { SetObjectGraphic(0,19)}
   
    //reload
   
If (GetObjectGraphic(0)==19)
    { SetObjectGraphic(0,20)}
}
#sectionend hotspot1_a  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for room: First time player enters screen
SetObjectGraphic (0,6) ; 
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE


Basicly its seeing wether a object is set at a certain image and if it is then its setting it to another.

Sorry if this is pretty simple, I'm knida new to the scripting side of things.

strazer

#1
If (GetObjectGraphic(0)==6)
    { SetObjectGraphic(0,7);} // you set pic to 7 here
else
If (GetObjectGraphic(0)==7) // this would be true if you didn't use "else" since you just set it to 7
    { SetObjectGraphic(0,8);} // set pic to 8...
else
...
etc. etc.

Add for all steps.

Does this help?

Edit:

Slightly shorter version of your script:

if (GetObjectGraphic(0) < 20) SetObjectGraphic(0, GetObjectGraphic(0)+1);

;)

Chicky

#2
hehe, thanks Strazer. I tried your *slightly* smaller script hehe, and it worked fine.

Thanks again :)

strazer


Mr Flibble

Can I suggest the starter of the thread puts a thumbs up beside it?
It would do it myself but I don't know if there are any more probs.
Ah! There is no emoticon for what I'm feeling!

TerranRich

#5
The moderators will do this. Mainly, me. Let me do my job!!!!! :P

QuoteI would do it myself...
And how would you go about doing that, O Non-Moderator? :P
Status: Trying to come up with some ideas...

Edwin Xie

Quote from: Moebius 5.18 on Sat 12/06/2004 22:28:31
The moderators will do this. Mainly, me. Let me do my job!!!!! :P

QuoteI would do it myself...
And how would you go about doing that, O Non-Moderator? :P

That makes me think that he is a person acting like a moderator. And, uhh I think that you want to do everything for yourself. It seems like you like your job.
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

TerranRich

Status: Trying to come up with some ideas...

SMF spam blocked by CleanTalk