Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Greater than, less than...

11 years ago

Here's what I'm trying to do: If one variable, let's call it ... "hunger" is greater than another variable, "food", then specific text will display, like "you've eaten all your candy, but your stomach is still growling." Of course, if "food" is greater than "hunger" I'd want different text to display, like "You've eaten half of your candy and you're so full, you can't eat another bite."

I already know how to make text display with specific amounts of variables, or > / < a certain number of a certain variable, but I haven't been able to get "if variable1 is greater than variable2" to work and, if I missed the article on it, feel free to just link me so I'll be out of your hair. xD

(Sorry for asking something so basic, I'm just still not very good at this.) 

Greater than, less than...

11 years ago

Greater than, less than...

11 years ago

%%VARIABLE1%>%%VARIABLE2%

Have you tried that? Note how there are two % signs before the second variable.

Greater than, less than...

11 years ago

Here's the working format:

%%GOLD%>%SPOON%Yes%%

Greater than, less than...

11 years ago

What about more than one variable? Would it be, like, %%GOLD%>%CUP%PLATE%SPOON%Yes%%?

Greater than, less than...

11 years ago

Not 100% sure, but if so, it would probably look like this:

%%GOLD%>%CUP%=%PLATE%<%SPOON%Yes%%

Greater than, less than...

11 years ago

I really doubt you can compare more than two things.

Greater than, less than...

11 years ago

I tend to agree - as the boolian logic gets really complex past that point!

Greater than, less than...

11 years ago

Well ... damn. That presents a problem. *hum*

Greater than, less than...

11 years ago

Well, say what do you actually want to do, and maybe we can come up with an alternative.

Greater than, less than...

11 years ago

Well ... I'm making a quiz and I was attempting to put all the results on one page, but scripted to only display individually. There are ten different results, not just two. Yeah, I know I've scripted a quiz before, but the personality quiz in GOLAD cuts off after you reach a certain amount for a certain variable and I had to make enough questions so it wasn't possible -not- to reach a result. So, you know: 5 results, 5 points per question, 15 points to reach a result = 15 questions. I'm just really not crazy about that method.

Greater than, less than...

11 years ago

Gonna need a lot more detail than that before we can actually help you lol. Say exactly what you want.

Greater than, less than...

11 years ago

Okay... uh ... all the results were going to be on the same page and each result was assigned to a single variable. You were suppose to increase the variables depending on how you answered the quiz, then the highest variable value would determine which single result displayed at the end.

I figured I could just script it so it compared all ten variables, then displayed only the result assigned to your highest variable.

(I thought of another method, but it just seems needlessly complicated.)

Greater than, less than...

11 years ago

What happens if there is a tie? What's the max/min the variables can be?

Greater than, less than...

11 years ago

As I was typing out my previous reply, I realized I'd actually forgotten to account for that possibility. *facepalm*

Also, my standard values for max and min are 100 and 0 respectively, until I find a good reason for them to be something else.

Greater than, less than...

11 years ago

What's the max and min they can actually be though? How many points could one be given by the end?

Greater than, less than...

11 years ago

I haven't actually decided the number of questions. I was thinking 20-25, and from 0 to 4/5 points per question. Minimum would still be 0, maximum would likely stay 100. 

Ah, gives me an idea. I could have the answers you give decrease the other values, that would help in preventing a tie.

Greater than, less than...

11 years ago

IF %POINTS >= 25 THEN

IF %POINT < 50 THEN

BEGIN

$PAGETEXT := "You did an okay job." + "</br>" + $PAGETEXT

END

Then put "You have %%POINTS%% points in total on the text page. 

 

IF %POINTS >= 50 THEN

IF %POINT < 75 THEN

BEGIN

$PAGETEXT := "You did a good job." + "</br>" + $PAGETEXT

END

Then put "You have %%POINTS%% points in total on the text page. 

 

IF %POINTS >= 75 THEN

IF %POINT < 100 THEN

BEGIN

$PAGETEXT := "You did a great job!" + "</br>" + $PAGETEXT

END

Then put "You have %%POINTS%% points in total on the text page. 

 

Are you looking for something like this? o.O

Greater than, less than...

11 years ago

Sadly, no. You're talking about comparing differing amounts of the same variable. I'm talking about comparing multiple different variables to each other.

Greater than, less than...

11 years ago

So something like...?

IF POINT1 > POINT2 THEN

IF POINT2 > POINT3 THEN

IF POINT3 > POINT4 THEN

BEGIN

$PAGETEXT := "BLAHBLAHBLAH."

END

Greater than, less than...

11 years ago

Umm... actually, I think it'd look more like

IF POINT1 > POINT2 THEN

IF POINT1 > POINT3 THEN

IF POINT1 > POINT4 THEN

BEGIN

$PAGETEXT := "BLAHBLAHBLAH."

END

... Is that possible?

Greater than, less than...

11 years ago

Yes. It is. As long is Point1 is greater than Point2,3,and 4 it should execute the codes. 

Greater than, less than...

11 years ago

Huh. Cool. =D I'll give it a shot.

Greater than, less than...

11 years ago

But wait. Make sure you only use it once. For example if you put...

IF %POINT1 > %POINT2 THEN

BEGIN

$PAGETEXT := "BLAH"

END

IF %POINT1 > %POINT3 THEN

BEGIN

$PAGETEXT := "BLAH"

END

 

If both is true, they would execute both pagetext, but if you set something like this...

%POINT1 := 25

%POINT1 := %POINT1 + %POINT2

This would cause the results to be erroneous. 

Greater than, less than...

11 years ago

Oh... then it won't work. *sigh* I think I have a plan, though.

Greater than, less than...

11 years ago

Okay Kiel. Explain to me how %POINT can be both an 1 and a 2 at the same time. 

Tell me exactly what you are trying to do. When I say exactly, I mean everything. Details. Are. Important. 

Greater than, less than...

11 years ago

%HIGHEST := %ONE
%ANSWER := 1

IF %TWO > %HIGHEST THEN
BEGIN
%HIGHEST := %TWO
%ANSWER := 2
END

IF %THREE > %HIGHEST THEN
BEGIN
%HIGHEST := %THREE
%ANSWER := 3
END

Repeat until you look though all of them, then use the %answer variable to determine the text.

Greater than, less than...

11 years ago

Yeah, but the thing is %ANSWER can only be one number at a time. It's either 1, 2, OR 3. It can't be 1, 2, AND 3. 

Greater than, less than...

11 years ago

Kiel said he didn't want ties to be possible, so I'm assuming he's adding another way to deal with them.

Greater than, less than...

11 years ago

This would make it so that it there's a tie, then the script will pick one randomly. 

IF %POINTS1 = %POINTS2 THEN

BEGIN

 

%ROLL := 1D2

 

IF %ROLL = 1 THEN

BEGIN

%POINTS1 := %POINTS1 + 1 

END

 

IF %ROLL = 2 THEN

BEGIN

%POINTS2 := %POINTS2 + 1 

END

 

END

Greater than, less than...

11 years ago

You can do more complex things with $PAGETEXT, but then it's more complex...