Hey All,
I'm getting a syntax error for running some script in an event:
[IMG]http://s16.postimg.org/kh1ggckh1/prob1.png[/IMG]
The script is:
$game_self_switches[[@map_id,1,'A']] = true
I thought this was pretty straightforward.. I'm trying to get the current event ("Door1" or EV002) to force EV001 (who's within the same map) to turn its self switch "A" on. I tried it with the literal map ID, too (MAP005), but no luck.
I must be missing something really simple-- according to what i've read, this is seems like the right script and setup..
I'm using RPG maker XP
PS. I know plain variables would work here, too, etc. There's probably a lot better ways of doing this, but right now I'm more worried about the script and why I'm wrong here >:
Sorry if this is a n00b thing; Thanks for the help!! 8)
Thanks Shaz!
That gets rid of the Syntax Error, but..
The target event still doesn't change. I'm pretty sure I'm targeting the right event. Do I need to force it to update?
'Much appreciated .-.
Please show screenshots of the event you want to change with that command. Basically that event needs to be set to react to the self-switch, and if you did something wrong no script command will help.
And one tip: use [alt]-[PrtScr] instead of only [PrtScr] to limit the screenshot to the active window
[IMG]http://s24.postimg.org/vem7p7n9h/prob1.png[/IMG]
--Bam! I'm trying to get the door(EV001) to change through its selfswitch instead of a variable switch or something, but EV002(Otherside) is the event that's actually handling the events, and thus has the "$game_self_switches..." script in it.
I'm wondering if it's an update or debug problem, because the script works if I put in an unrelated variable change in there:
[IMG]http://s9.postimg.org/3zjzc41e7/prob2.png[/IMG]
Here I just made up the ControlSwitch "DoorUpdater" variable. Sticking it on the end of the script seems to make the self switches work as planned...
Technically I can get things to function-- I'm just wondering why it doesn't work by itself.
Also, It's dumb but I never knew about the [Alt]-[PrtSc] thing, haha 8)
Thanks!
After the $game_self_switches, try adding a line that says $game_map.need_refresh = true
This SHOULD already be done simply by changing the self switch. Let us know if it makes a difference.
Sweet!
It did make a difference. Things seem to function as intended now.
'Many thanks Shaz!
Very strange. It should have done that all along - and in fact it DOES do that when I use script calls in my game.
Ah, there you go. In XP it doesn't do the update. It was lucky that the command I gave you from Ace was the same 😀
Here's what's going on ...
In XP, the Interpreter class takes care of setting the $game_map.need_refresh flag to true when you do Control Switches, Control Variables, or Control Self Switch. Because you're doing it in a script call, that line in the interpreter isn't being run.
Here's something you can do (and what they did in Ace, and maybe VX as well, when the shortcoming was discovered) that will mean you won't have to add this command every time you change a variable, switch or self switch by a script call:
In your script, find the Game_Switches, Game_Variables and Game_Self_Switches classes. Within each one, in the []= method, straight after the assignment (@data[switch_id] = value, $data[variable_id] = value and @data[key] = value), add a new line with $game_map.need_refresh = true. That means no matter how you assign the value to the switch, variable or self switch, the map will be updated.