View Full Version: Using "_ifVariableSkip" conditional

lassie >>Knowledge Base >>Using "_ifVariableSkip" conditional


<< Prev | Next >>

bigmac- 05-31-2006
Using "_ifVariableSkip" conditional
A question was risen about the "_ifVariableSkip" conditional, so I went back and read the documentation on it again. LOL, it does kind of read as an explosion of logic. So, I hope the following response offers some clarification on the subject. What you need to understand first is what this conditional will do. The premise is that if the condition you specify is fulfilled, then then next X number of TIMes (following the conditional) will be skipped. Lets say you only want to show a room's intro animation once. In very simple terms, the logic would proceed as follows: :arrow: if the intro has been played, then skip the next X TIMes. Okay so far? Now lets cover the basic logic. Lets say we'll track a variable called "intro" with this command. When the game starts, the variable "intro" does not exist... And because "intro" does not exist, we'll allow the animation to play. As we tell the animation that it is allowed to play, we'll also create the variable called "intro" with the setVariable command. In the future when this room is entered, the variable "intro" will again be checked for, at which time it WILL exist (because the movie has played once), so we will NOT allow the movie to play again. Still with me? I hope so, because now we get into the actual program logic. _ifVariableSkip('intro', 'playedOnce', #true, 2) playSequenceHere...() setVarialbe('intro', 'playedOnce') There it is. So, what does that mean? The conditional is looking at the variable called "intro" and asking if its value is "playedOnce". So: :?: Q: is intro = "playedOnce" ? :arrow: A: Before "intro" has been set, the result will be FALSE :arrow: A: After "intro" has been set, the result will be TRUE Then, according to the third and forth paramter, we are telling the operation to skip the next 2 TIMes if the result of that question was TRUE. So: :?: Was the outcome of our last question "true"? :arrow: YES: ok, then skip the next two TIMes. :arrow: NO: ok, then keep processing actions.

JohnGreenArt- 05-31-2006

Ah! Makes sense.

JohnGreenArt- 01-24-2008

I'm having trouble getting variables to work. Here's my situation: I want the character to say a line of dialogue upon entering a room, but only on the first time he enters. So, I figured I'd use a variable that would play an animation sequence that would include the dialogue I wanted. Here are the TIMe's: fadeScreen(0, #null, #null, #true, #true) _ifVariableSkip('brenter', 'playedOnce', #true, 2) playSequence('redlightjoke') setVariable('brenter', 'playedOnce') The first is the standard fade in that all enter room TIMe's have. The second checks the to see if the variable named "brenter" is set to "playedOnce". Since "brenter" hasn't been set, the anser is FALSE. The third TIMe plays the animation sequence, that of the character just saying a line of dialogue. The fourth TIMe sets the variable to "playedOnce". The problem I'm having is that it plays the dialogue EVERY time the character enters the room. It won't skip the playSequence TIMe. I thought maybe the setVariable TIMe was somehow getting skipped, so I even put that in the animation sequence, before the playDia() TIMe, and it still plays the dialogue every time you enter the room. Anyone have any suggestions, or notice what I'm doing wrong?

PinkFrangipani- 01-24-2008

Sorry, I can't help much here. I can only say that most TIMe commands that begin with 'set' (setCursorEnabled, setConversTopicRank etc.) don't seem to work for me, including this one. So maybe the problem lies elsewhere?

JohnGreenArt- 01-24-2008

Hmm... Yes, I'm had problems with other 'set' TIMe's as well...

NigeC- 01-24-2008

I know when me and Adventureman tried to use variables they never worked, hence why the statues in HW and Tucker's gates puzzle in SA2 where done with muliple sprites and phases.. kinda like cracking a nut with a atomic bomb really :roll:

PinkFrangipani- 01-24-2008

Glad to read I'm not the only one who used zillions of sprite phases! :D

NigeC- 01-24-2008

HW had four pedistals, four statues.. so thats 16 combination plus remove phases, image movies on each pedistal with five phases, right and wrong phases.. and phases for the book that opened...oh it was great fun! a tip with doing that sort of thing is while building, call each phase a different name so you can keep track while -*test*-('")ing, mine where phase 1 to 16 on each stand... its a bit tedious going back and renaming them but save a lot of time will debugging

Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.