Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Use 2 variables in 1 on-page script statement?

5 years ago

The tutorials explain very easily how to use a single variable value to hide or reveal text on a page. For example,

    %%VARIABLE%=%1%insert variable dependent text here%%.

But is it possible to have a single block of text that depends on two variables using this technique (or something similar)?

For example, if you have VARIABLE1 and VARIABLE2, I'm looking for something like

    VARIABLE1%=%1% AND VARIABLE2%=%1%

and then all the text would follow.

I'm hoping for a simple on page variable trick. So far, the only solution I can think of is to have a script relating VARIABLE1 and VARIABLE2 to VARIABLE3, and the statement in the page script

    IF %VARIABLE1 = 1 AND %VARIABLE2 = 1, THEN %VARIABLE3 := 1

, and then use

    %%VARIABLE3%=%1%insert variable dependent text%%.

So is there some easy way to do this on page without using a third variable?

Although, now that I think about it, the solution in this post might work fine. But I think it might be a bit clunkier. If there is no other way I'll live, but it would be cool if we could use AND and OR statements and the like with on page scripting.

Use 2 variables in 1 on-page script statement?

5 years ago
I don't see why you'd need the third variable at all. AND statements work just fine unless you're using < or > symbols. Why not just say:


IF %VAR1 = 1 AND %VAR2 = 1 THEN $PAGETEXT := $PAGETEXT + "Whatever you want to say here."


Does that answer your question?

Use 2 variables in 1 on-page script statement?

5 years ago
He's talking about on page variable text though. Being able to use AND instead of the third variable definitely would streamline that and be useful in a lot of situations.

Use 2 variables in 1 on-page script statement?

5 years ago
Right. I am talking about on page scripting. Now I wonder if nested on page scripting will work?

Actually on 2nd thought that won’t work because the nested %% will be interpreted as tha end of the previousl thought

Use 2 variables in 1 on-page script statement?

5 years ago
Yeah, so far as im aware combining the variables into one is the only way to accomplish what you want.

Use 2 variables in 1 on-page script statement?

5 years ago
Also I vote that Leora's game be disqualified, if she doesn't know the difference between on page variable text and $PAGETEXT she clearly didn't write it herself!!

Use 2 variables in 1 on-page script statement?

5 years ago
Lol Miz. I used $PAGETEXT any time the text changed in my game. I don't pretend to be an expert and there are likely many ways my code could be improved. I assumed that he was talking about page scripts. If that is a different thing, my mistake. It certainly doesn't have anything to do with my own game or the seemingly endless hours I put into it having known nothing about scripting beforehand. You're an admin, you could just check the code if you don't believe me :P