you can use this Function:
http://docs.textadventures.co.uk/quest/ ... tains.htmland these Functions too:
http://docs.textadventures.co.uk/quest/ ... ldren.htmlhttp://docs.textadventures.co.uk/quest/ ... jects.htmland these Scripts too:
http://docs.textadventures.co.uk/quest/scripts/do.html(you can use either one, generally they're the same thing)
http://docs.textadventures.co.uk/quest/ ... nvoke.html-------------------------
for an example:
use these GUI~Editor Scripts to do code lines below:
run as script -> add new script -> output -> "print a message" Script -> print [MESSAGE] type_in_what_you_want
run as script -> add new script -> scripts -> 'if' Script -> if [EXPRESSION] type_in_the_rest___see_below*
* but it's too hard to explain what parenthesis to type in, and what parenthesis to not type in... hmm... this is what you'll type in:
not GetDirectChildren(chest1) = null
random_selection = GetRandomInt(1,3)
random_selection = 1
Contains(chest1, sword1)
etc etc etc
run as script -> add new script -> variables -> 'set a variable or attribute' Script -> (see below)
set variable type_in_the_rest___see_below = [EXPRESSION] type_in_the_rest___see_below
and... I'm not sure how'd you do the 'invoke' (nor 'do' ), in the GUI~Editor... hopefully you can figure this out...
// chest1
// -> sword1
// -> candy1
// -> potion1
// the 'chest' container Object's 'take' Verb's scriptings (add new scripts):
if (not GetDirectChildren(chest1) = null)
{
random_selection = GetRandomInt(1,3)
if (random_selection = 1)
{
if (Contains(chest1, sword1))
{
MoveObject(sword1, player)
msg ("You take the sword from the chest.")
}
else
{
msg ("The sword has already been taken from the chest.")
msg ("You try again to search the chest.")
invoke (chest1.take)
}
}
else if (random_selection = 2)
{
if (Contains(chest1, candy1))
{
MoveObject(candy1, player)
msg ("You take the candy from the chest.")
}
else
{
msg ("The candy has already been taken from the chest.")
msg ("You try again to search the chest.")
invoke (chest1.take)
}
}
else if (random_selection = 3)
{
if (Contains(chest1, potion))
{
MoveObject(potion, player)
msg ("You take the potion from the chest.")
}
else
{
msg ("The potion has already been taken from the chest.")
msg ("You try again to search the chest.")
invoke (chest1.take)
}
}
}
else
{
msg ("The chest is empty.")
}
this is not the best design... but let's not care about that... until we need to, you're just learning the basics right now... we'll deal with better design (code efficiency), later.