Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Do Variables have to be Alphabetical?

10 years ago

When I am using Variables in the Advanced Story Game maker thingy there are some that I like to be visible to the reader. Some are testable skills (Accuracy, Charisma, Health etc) and some are possessions such as Achievements, Cartridges and Money which are better expressed numerically than with the Item Provider thing because they are added to and deducted rather than "used". Is there a way to divide these Variables into catagories because at the moment they are all jumbled together alphabetically and there is no clear distinction between skills and possessions when both are variables. I could use the Item function for the possessions I suppose but they are much more useful as Variables

A related question is that is it possible to have a Variable that is a word instead of a number as a Variable such as Healthy, Wounded, Badly Wounded, Mortally Wounded and Dead to represent a character's health status for example? I could express this idea with numbers but words is preferable...

If any nice person can give me any information on these things I'll be very happy :)

Do Variables have to be Alphabetical?

10 years ago
Nope to both. Unfortunately, variables are quite rudimentary.

You can do a work around for the variable as a word though. If you put this in your story:

%%HEALTH%=%0%Dead%%%%HEALTH%=%1%Mortally Wounded%%%%HEALTH%=%2%Badly Wounded%%%%HEALTH%=%3%Wounded%%%%HEALTH%=%4%Healthy%%

It will say "Healthy" or "Mortally Wounded" or whatever based on the value of the HEALTH variable. Just replace HEALTH with the name of your variable.

Do Variables have to be Alphabetical?

10 years ago

Using the "Display On All Pages" feature, yes; they'll always be sorted alphabetically. To organize them, you'd need to use a global page script instead that appends the variable values onto the $PAGETEXT. Text variables are not possible, but you can get around that using conditional statements. If you wanted it to look similar to how it does when you use "Display On All Pages", the code would look something like this:

$PAGETEXT := $PAGETEXT + "<div style='clear:both;margin-top:10px;'>"
$PAGETEXT := $PAGETEXT + "Accuracy is " + %ACCURACY + ".<br>"
$PAGETEXT := $PAGETEXT + "Charisma is " + %CHARISMA + ".<br>"
$PAGETEXT := $PAGETEXT + "</div>"

The first and last lines define an area for the text and should stay as they are, but the inner lines can be changed (using the scheme $PAGETEXT := $PAGETEXT + "[Variable] is " + %[VARIABLE] + ".<br>"). The <br> creates a line break so the text isn't all on the same line. As for health, the following conditional statements could be put into the code (in between the first and last lines):

IF %HEALTH = 0 THEN $PAGETEXT := $PAGETEXT + "You are dead.<br>"
IF %HEALTH = 1 THEN $PAGETEXT := $PAGETEXT + "You are mortally wounded.<br>"
IF %HEALTH = 2 THEN $PAGETEXT := $PAGETEXT + "You are badly wounded.<br>"
IF %HEALTH = 3 THEN $PAGETEXT := $PAGETEXT + "You are wounded.<br>"
IF %HEALTH = 4 THEN $PAGETEXT := $PAGETEXT + "You are healthy.<br>"

Do Variables have to be Alphabetical?

10 years ago

Thank you both for your help. Is there a site or list that provides translations of coding and what effect it has on a story game? I've browsed through the Help and Info section which combined with these helpful examples has given me some stuff to work with... even Items and Variables are melting my brain at the moment so to avoid the story-games getting too GAME and not enough STORY it might be time to go back to Basic for a while... thank you again for your help, this is all very useful :)

Do Variables have to be Alphabetical?

10 years ago

Try the scripting section. Scripting is unique to CYS, so it'll be a few years before it takes over the world and people start making websites about it.