different object descriptions before and after an event
smappdi
01 Dec 2010, 12:34Searched for this but couldn't find it - how do I change the description of an object (that is, what's printed when a player types "look at [object]") after it's acted upon by the player? For example, I'd want one "look at" description for a match before the player types "light match" (ex. typing "look at match" yields "It's an unused match.") and after they type it (ex. typing "look at match" yields "The match is lit and glowing yellow.")
sbangs
01 Dec 2010, 13:24I would use 2 conditionals. One for your "light" match verb assigned to the object, like this.
If "match" has the property "lit" Then Print "Your match is already lit." Else {
Modify "match"'s property: "lit"
Print "You have lit the match!" }
Then for your "look" script use the following, again another conditional.
If "match" has the property "lit" Then Print "You see a burning match!" Else Print "You see a match, wanting to be on fire!"
Also, you could use a Timer to turn the match off, or fire dies out after so many seconds, here is an example of a timer that is activated when you "light" the match.
I created a Status Variable called "match lit time" and set the numeric value to 5".
I created a Timer named "lit match" which will fire on the "light match" command.
Note the new "light match" script here:
If "match" has the property "lit" Then Print "Your match is already lit." Else {
Modify "match"'s property: "lit"
Print "You have lit the match!"
Turn on timer "lit match" }
Now the Timer named Lit match will fire with above script, and execute the below script every second.
If "%match lit time%" is equal to "0" Then {
Print "The match has died out. "
Turn off timer "lit match"
Change the contents of variable "match lit time" to "5"
Modify "match"'s property: "not lit" } Else {
Print "Your match has been lit for %match lit time% seconds. "
Decrement "match lit time" by "1" }
Hope that helps.
S
If "match" has the property "lit" Then Print "Your match is already lit." Else {
Modify "match"'s property: "lit"
Print "You have lit the match!" }
Then for your "look" script use the following, again another conditional.
If "match" has the property "lit" Then Print "You see a burning match!" Else Print "You see a match, wanting to be on fire!"
Also, you could use a Timer to turn the match off, or fire dies out after so many seconds, here is an example of a timer that is activated when you "light" the match.
I created a Status Variable called "match lit time" and set the numeric value to 5".
I created a Timer named "lit match" which will fire on the "light match" command.
Note the new "light match" script here:
If "match" has the property "lit" Then Print "Your match is already lit." Else {
Modify "match"'s property: "lit"
Print "You have lit the match!"
Turn on timer "lit match" }
Now the Timer named Lit match will fire with above script, and execute the below script every second.
If "%match lit time%" is equal to "0" Then {
Print "The match has died out. "
Turn off timer "lit match"
Change the contents of variable "match lit time" to "5"
Modify "match"'s property: "not lit" } Else {
Print "Your match has been lit for %match lit time% seconds. "
Decrement "match lit time" by "1" }
Hope that helps.
S
smappdi
03 Dec 2010, 08:38That does help, thanks.