I want to switch the scene or room when the a button is pressed. I understand how to detect a button press but am unsure how to switch the room with pulpscript.
please help
thankyou!
I want to switch the scene or room when the a button is pressed. I understand how to detect a button press but am unsure how to switch the room with pulpscript.
please help
thankyou!
You can do this:
goto 12,12 in "roomhere"
The 12,12 is the X and Y coords.
Also, no matter what is using goto it will move the player to that location.
There's a few ways you can do this, assuming you want to use the A button to change the room (scene) you could add the following:
Player Script
on confirm do
if event.room=="scene1"
goto x,y in "scene2"
end
end
Alternatively you could use confirm to tell the room to call a custom event:
Player Script
on confirm do
if event.room=="scene1"
tell event.room to
call "CustomEvent"
end
end
end
scene1 Room Script
on CustomEvent do
goto x,y in "scene2"
end
Or you could set a flag instead of checking for the room, like this:
Player Script
on confirm do
if Variable==1 then
goto x,y in "scene2"
end
end
scene1 Room Script
on enter do
Variable = 1
end
on exit do
Variable = 0
end
Or you could use a flag to tell the room to call a custom event:
Player Script
on confirm do
if Variable==1 then
tell event.room to
call "CustomEvent"
end
end
end
scene1 Room Script
on enter do
Variable = 1
end
on CustomEvent do
goto x,y in "scene2"
end
on exit do
Variable = 0
end
Personally I prefer using flags so I don't have to type out the names of rooms as much. I also prefer to tell the room to call a custom event because it moves some of the code over to the room's script, which helps the player's script not get bloated with tons of different goto
commands with no explanation of why the player is moving to a new room (or different coordinates in the same room). Instead the CustomEvent
name can describe what the event is meant for.