'get input' inside a code loop

TinFoilMkIV
I'm wondering if there's a way to create a code loop that contains a 'get input' command. It seems as though the 'get input' will wait for the trigger to activate the code contained within itself, however any code outside of it is still executed, resulting in an error stating that only one 'get input' may be active at a time, an breaking the code loop.

an example of what I was attempting is this
loop = true
while (loop) {
get input {
if (result = "keyword") {
msg ("you may continue")
loop = false
//stuff happens
}
else if (result = "leave") {
msg ("you give up, for now...")
loop = false
//go back
}
}
}

so requesting input, where failing to enter an acceptable response prompts the same 'get input' until the player enters an option that the game allows.

Pertex
you can do this by calling a recursive function:
  <function name="input">
get input {
on ready {
if (result = "keyword") {
msg ("you may continue")
// stuff happens
}
else if (result = "leave") {
msg ("you give up, for now...")
// go back
}
else {
msg("false")
input()
}
}
}
</function>

TinFoilMkIV
Yea I came to that conclusion while I was away. I think I may store these functions inside room or controller object attributes, as I'd really like to avoid cluttering up the global function list with things like 'player_inventory_drop_menu1()' or 'combat_general_commands_menu()'

Most of this stuff is really going to apply to a single room or block of code so I'm thinking storing it in an attribute may be the best option for now.

HegemonKhan
you can use Objects for data storage:

<game name="xxx">
</game>

<object name="global_data_object">
<attr name="gender_stringlist_attribute" type="simplestringlist">male;female</attr>
<attr name="xxx" type="script">
// blah scripts
</attr>
<object name="sword_1">
<alias>claymore</alias>
// etc Attributes
</object>
// etc other Objects and~or Attributes
</object>

// or, you can do locally too:

<object name="room">
<object name="room_local_data_object">
<attr name="gender_stringlist_attribute" type="simplestringlist">male;female</attr>
// etc other Objects and~or Attributes
</object>
</object>

// and you can also put scripts into Functions, which are global (I don't think Functions can be local).

// you can also put scripts into Commands, which are global (I don't think Commands can be local).

// there's also Turnscripts and Timers, both of which can be global or local.

// you can also use the 'game' Game Object to store data too (though I don't like to crowd this up, prefering to use the independent 'Data' Object

TinFoilMkIV
yea, although if the script strictly pertains to one room, might as well make it an attribute of that room.

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

Support

Forums