Question about variables

Error message

Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /var/www/pied-piper.ermarian.net/includes/common.inc).
AuthorTopic: Question about variables
Agent
Member # 8030
Profile Homepage #0
I haven't had any need for variables so far, as the scripts work fine without them. However, after looking at some of JV's scripts, can variables be set as say...

variables;
i == get_flag(4,1);
j == char_has_trait(get_memory_cell(4),12);
k == get_spell_level(get_memory_cell(4),0,7);
Thanks

--------------------
Decca Records - "We don't like their sound. Groups of guitars are on the way out."
Posts: 1384 | Registered: Tuesday, February 6 2007 08:00
Shaper
Member # 7472
Profile Homepage #1
Close. Only one equals sign is used when assigning variables, and each line of integer variables requires a short before initialization.

So it'd look more like this:
variables;
short i = get_flag(4,1);
short j = char_has_trait(get_memory_cell(4),12);
short k = get_spell_level(get_memory_cell(4),0,7);


[ Monday, March 24, 2008 09:46: Message edited by: Nioca ]

--------------------
Hz'ii'zt a'iiencf coxnen a'bn'z'p pahuen yzpa'zuhb be'tt'phukh'kn az'ii'ova mxn't bhcizvi'fl?

Nioca's Citadel - A resource for BoA graphics and scripts, as well as my scenarios.
Posts: 2686 | Registered: Friday, September 8 2006 07:00
Law Bringer
Member # 4153
Profile Homepage #2
Yes, they definitely can be set to things like that. However, there's a few things that need to be fixed...

variables;
short i = get_flag(4,1);
short j = char_has_trait(get_memory_cell(4),12);
short k = get_spell_level(get_memory_cell(4),0,7);
Each numeric variable needs to have 'short' before it. Also, when defining a variable, you just use one '='. The symbol '==' tells the game to check if, say, variable i is equal to the value of flag (4,1).

EDIT: Curse you, Nioca!

[ Monday, March 24, 2008 09:46: Message edited by: Ephesos ]

--------------------
Gamble with Gaea, and she eats your dice.
Posts: 4130 | Registered: Friday, March 26 2004 08:00
Lifecrafter
Member # 7538
Profile Homepage #3
Alright, I have a question now, regarding the variable's data type. You both mentioned short, but I've seen short and int used interchangeably (I think). Is there a difference between the uses of the two?

--------------------
Do not provoke the turtles.
They do not like being provoked.

-Lenar

Always remember, kids: every time you 'lol', God kills a kitten.

My website: Nemesis' Refuge (Last Update: 3/7/08)
Posts: 743 | Registered: Friday, September 29 2006 07:00
Lifecrafter
Member # 6193
Profile Homepage #4
Nope.

--------------------
"NOW PASS ME MY BOOTS. I HAVE AN APPOINTMENT WITH A FACE." -Nikki

Tales From the Tabard Inn: Now if only there was a 3600 Hour Contest.....
Posts: 900 | Registered: Monday, August 8 2005 07:00
Agent
Member # 8030
Profile Homepage #5
Thank you, thought I recently discovered using Jeff's variables makes dialog boxes much easier to script.

--------------------
Decca Records - "We don't like their sound. Groups of guitars are on the way out."
Posts: 1384 | Registered: Tuesday, February 6 2007 08:00
Warrior
Member # 8872
Profile #6
In Avernumscript, does 'short' basically mean 'short int'? And is it signed?

[ Tuesday, March 25, 2008 16:32: Message edited by: Fractal ]

--------------------
Slarty: "Why don't we all just get along?"

The Mystic: "Vista is a funky and finicky OS to begin with."
Posts: 197 | Registered: Saturday, June 2 2007 07:00
Shock Trooper
Member # 10488
Profile #7
Yes, and probably.
Posts: 334 | Registered: Friday, September 14 2007 07:00