Integers: Global Script

Started by Terrorcell, Mon 08/09/2008 07:00:45

Previous topic - Next topic

Terrorcell

When you have your room script open and you want to type, for example, int car = Random(5); for whatever reason, it will pass that integer on but if you typed the same thing in the Global Script, it will come up with an error.

Just a question that I've been pondering for a while now,

Terrorcell.

monkey0506

Even if it's in the room script that line wouldn't (shouldn't) compile outside of a function. If it does compile, it would crash the game as soon as the room is loaded. The reason is that Random(5) is a call to a function. AGS doesn't allow you to call functions from outside of a function as it wouldn't know when to call the function.

Khris

Or to put it another way: you can only assign initial values that are constants.

Terrorcell

Ok, thanks for clearing that up for me guys  ;)

SMF spam blocked by CleanTalk