Script help
hey896
14 Nov 2014, 14:54How do you, using script send the player to another page?
Right now I have two if conditions and a printed message. After this I want to send the player to another page which will be the end of the game.
Either that or could someone tell me how to use the 'finish' code properly? I was trying to use it but it didn't want to work.
Thanks
Right now I have two if conditions and a printed message. After this I want to send the player to another page which will be the end of the game.
Either that or could someone tell me how to use the 'finish' code properly? I was trying to use it but it didn't want to work.
Thanks

jaynabonne
14 Nov 2014, 15:31To move the player to a new page, use the "Move player to" script, selecting "page" and the page name. The internal script is "MovePlayer".
Could you describe how the finish command "didn't want to work" for you?
Could you describe how the finish command "didn't want to work" for you?
hey896
14 Nov 2014, 16:17The 'finish' command didn't work when I put it at the end of the script line like it said I was supposed to.
I probably didn't do it right, but that's how I saw you were supposed to do it.
I probably didn't do it right, but that's how I saw you were supposed to do it.
HegemonKhan
15 Nov 2014, 00:18an example of using 'finish' (though this is using the Text Adventure version, not the Gamebook version), and also, it's done in code (easy+quick for me to get it posted for you, lol):
(in this example, 'finish' will only activate~execute, when the player gets killed, when player.life_integer <= 0, which only happens if the orc is still alive, as it needs to be able to attack you, to reduce your life)
(in this example, 'finish' will only activate~execute, when the player gets killed, when player.life_integer <= 0, which only happens if the orc is still alive, as it needs to be able to attack you, to reduce your life)
<object name="player">
<attr name="life_integer" type="int">999</attr>
<attr name="damage_integer" type="int">100</attr>
</object>
<object name="orc">
<attr name="dead_boolean" type="boolean">false</attr>
<attr name="life_integer" type="int">500</attr>
<attr name="damage_integer" type="int">50</attr>
</object>
// a 'fight' Verb for the 'orc' Object:
if (orc.dead_boolean = true) {
msg ("The orc is already dead, silly.")
} else if (orc.dead_boolean = false) {
orc.life_integer = orc.life_integer - player.damage_integer
msg ("You attack the orc.")
if (orc.life_integer <= 0) {
orc.dead_boolean = true)
msg ("Your attack was fatal, you killed the orc.")
} else {
player.life_integer = player.life_integer - orc.damage_integer
msg ("The orc attacks you.")
if (player.life_integer <= 0) {
msg ("The orc's attack was fatal, the orc killed you.")
msg ("GAME OVER")
finish
}
}
}