I have this code:
switch (player.Room) {
1: candleobjnum=3; break;
2: candleobjnum=7; break;
...
55: candleobjnum=1; break;
58: candleobjnum=-1; break;//no candlelight object
}
I tells the system what object number the "CandeLight" object was for each room. (next time I'm using a GUI :/)
When I run, I get the error: "improper argument '1' for Switch statement." or something of the like.
What is wrong with this? I thought 'switch (result of numer operation) { .... }' was the *only* argument you could put in there anyway?
I can't help you with that, but I do want to chime in that I needed an object to be animated from the global script, so instead I made the object a character.
You need to add "case" before each case value:
switch (player.Room) {
case 1: candleobjnum=3; break;
case 2: candleobjnum=7; break;
There are examples in the manual: https://www.adventuregamestudio.co.uk/manual/ags43.htm#switchstatement
Oh dear, I've done a bad thing :/
Sorry guys.