View Single Post
Old 10-23-2022, 02:43 PM   #3
Izulde
Head Coach
 
Join Date: Sep 2004
After messing around with different things - trying to import transparent image into Google Slides (it doesn't have a save picture as option so that didn't work), downloading GIMP (probably should have done that to begin with), I discovered that TyranoBuilder offers a resizing of images via mouse middle button scrolling.

Hooray! This will save me literally hours of hassles.

So I taught myself multiple option if-else statements that evaluate a single condition...

...or I thought I did. But then I was running into problems when I playtested it. Come to find out, you have to put an [endif] after every single option in order for it to run correctly. Once I figured that out, everything was smooth sailing.

Don't know what I mean? Here's an example of what I was doing:

[if exp= "f.variable == 1"]
#OtherCharacter
Blahblah
[else]
[if exp= f.variable2 == 1"]
#OtherCharacter
BlehBleh
[else]
[if exp= f.variable3 == 1"]
#OtherCharacter
BlohBloh
[endif]

What I intended was for the program to check each variable one by one and display the appropriate remark by OtherCharacter. Instead, I was getting errors.

Each [else] needed an [endif] after it before the program would move on to checking the next variable's condition.

Other beginner notes:

== means that the value of the variable is equal to, whatever (in this case 1)

Want to have it say If variable is 1 OR 2, then this happens?

[if exp= "f.variable == 1" || "f.variable == 2"]
This happens
[endif]

The || means or

Another fun note: In Tyranobuilder, integers come as pre-defined values for variables. When you try to put text as a value for a variable, it hurls an "Uncaught Reference: ThisTextValue is undefined" error at you.

There's two ways of fixing this:
1. Convert the value to an integer (such as 1)
2. Declare the variable at the beginning of your script to allow the text value to be recognized.

Since this particular variable is something that once set, doesn't change, I just converted it to an integer value and it was all good after that.

I'll have to learn how to declare variables at some point, but since I don't need to yet, I'll keep chugging along.
__________________
2006 Golden Scribe Nominee
2006 Golden Scribe Winner
Best Non-Sport Dynasty: May Our Reign Be Green and Golden (CK Dynasty)

Rookie Writer of the Year
Dynasty of the Year: May Our Reign Be Green and Golden (CK Dynasty)
Izulde is offline   Reply With Quote