Re: [tsc-devel] Re: Switch directory name change impacts level scripts...

datahead | Mon, 07 Nov 2016 05:03:17 UTC

I've found that switching from:
[code]on_touch do  |other|[/code]
(and setting the image property manually)
to
[code]Std::Switch.new(switchObject) do[/code]
...automatically sets the switch image for me, fixing the issue I had in which an outdated path for the switch image was being used.

However, now I need to update my function:
[code]Level.on_load do |store|[/code]

Before I was able to check a boolean variable I saved and then set the image property of the switch.  This, however, is bad practice, as the scripting language cannot fix the image for me if the path changes again later.

What is the proper way now to set a switch to pressed/unpressed in the script code?

Also, it looks like the scripting doc is out of date from what I can tell on the website.

Lastly, it looks like the extra levels with switches I looked at do not have save/load logic, which will cause an incorrect save state with respect to switch states.  Since they are prepackaged levels, I suspect I should probably file a bug for this in the tracker.