Sorry about the late reply, I worked it into my code but I wanted it to only run once the number pad has been looked at. How should I go about doing this?
Use a boolean to store that the safe has been examined, then only allow dialling a number if you have seen the keypad (has_seen_keypad == true).
start_at = office
locations {
office : location "You are in an office." ;
}
objects {
safe : scenery "a safe" start_at = "office";
}
booleans {
has_seen_keypad : boolean "false" ;
}
on_command {
: if_examine "safe" {
: print "The safe has a <KEYPAD<12>>.\nIt looks like you need to <DIAL<13>> a 4 digit combination (e.g. <DIAL 0000<14>>)." ;
: set_true "has_seen_keypad" ;
: done ;
}
: match "dial _" {
: if (is_present "safe" && has_seen_keypad == true) {
: if (is_int(original_noun1())) {
: match "dial 1234" {
: print "You enter the correct safe combination" ;
: done ; // Stops it from matching anything else
}
: print "Wrong Combo" ;
}
: else {
: print "Please type DIAL XXXX (where XXXX is a number)." ;
}
}
: else {
: print "Dial what?" ;
}
}
}