Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Multiple Scripts on the Same Link

11 years ago

I'm having a little trouble with scripting. Is it possible to have multiple script if statements on the same link? 
For example, if I went into the script edit box and did this:

IF ...
THEN...
ELSE...

IF...
THEN...
ELSE...

IF...
THEN ...
ELSE...

Do I need a divider between the three if statements?

Multiple Scripts on the Same Link

11 years ago

  You can divide them by BEGIN and END

Multiple Scripts on the Same Link

11 years ago

No, you don't. The begin/end the guy above me talks about is if your IF/ELSE statements have multiple lines.

So:

IF %SCORE = 3 THEN
BEGIN
%HEALTH := 4
%ATTACK := 3
END
ELSE
BEGIN
%HEALTH := 7
%ATTACK := 7
END

Is how you'd use it (if I'm not mistaken). So long as you do the if statements correctly, you don't need anything else to separate them. As an example, this is in one of my stories:

%SCORE := 0
IF %E0AGOOD = 1 THEN %SCORE := %SCORE + 1
IF %E0TGOOD = 1 THEN %SCORE := %SCORE + 30
IF %E0IGOOD = 1 THEN %SCORE := %SCORE + 500
IF %E0OGOOD = 1 THEN %SCORE := %SCORE + 7000
IF %TRUEEND = 1 THEN %SCORE := %SCORE + 90000

Notice how I don't need anything between each IF statement.

Multiple Scripts on the Same Link

11 years ago

Oh...