gamebook input problem

Siyahpanda
I wrote this with functions '
if (bradikardi) {
MovePlayer (Page2)
}
else if () {
MovePlayer (Page3)
}


But I don't know how to add this code on my game. I tried to paste it but it wasnt work.

>>


What should I do ? (( Im beginner and I want to do ,, if player write 'x' move to page 1 else page 2 ,, ))

HegemonKhan
I'm not familiar with the game code for Gamebooks, but for your scripting, it should be this:

msg ("What is your input?") // or whatever you want to say~ask here
get input {
// with 'get input' and 'show menu' Scripts, the quest engine automatically (hidden from you) sets:
// result = your_typed_in_input_during_game_play
// or for 'show menu' Script: result = your_selected_choice_during_game_play
if (result = "bradikardi") {
MovePlayer (Page2)
} else {
MovePlayer (Page3)
}
}


or, if you want more than 2 choices:

msg ("What is your input")
get input {
if (result = "bradikardi") {
MovePlayer (Page2)
} else if (result = "xxx3")
MovePlayer (Page3)
} else if (result = "xxx4")
MovePlayer (Page4)
} else if (result = "xxx5")
MovePlayer (Page5)
// etc etc etc more 'else ifs', or less too
} else {
MovePlayer (Page6)
}
}


I'm not sure about Gamebook, so if the...

MovePlayer (PageX)

doesn't work, try this (this is what it looks like in Text Adventure quest version):

MoveObject (player, PageX)

------------

again I don't know Gamebook code that well, but if it does have Functions, and you made your scripting block with a Function, then in the page's script where you want the script to run~execute~activate, then you just 'call function', which in code looks like this:

// I don't know how the 'page' Object looks in code, as I don't know the game code for Gamebook quest version:
// PageX:
<script>
brandikardi_function
</script>
// PageX

<function name="brandikardi_function">
msg ("What is your input")
get input {
if (result = "bradikardi") {
MovePlayer (Page2)
} else {
MovePlayer (Page3)
}
}
</function>

jaynabonne
Siyahpanda, you're trying to put the script in the room description. You need to add it as script. You can enter the script using the GUI script editor (where you will add individual statements for "if", calling functions, etc), or you can switch to code view and enter the code there. The way I often do it is to add a dummy "print message" with the GUI script editor to give the script a body, and then switch to code view and replace it with the code I really want.

jaynabonne
And to avoid confusion, you can't use "get input" in game books without jumping through some hoops to get the command prompt to show up. Since it wasn't your original question anyway (you were asking how to input a script), you can safely ignore the "get input" stuff above.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums