What would be the easiest way to create a "before taking" script? #1282
-
I want to do something like this for an object's this.cantake = true
if (HasScript(this, "beforetryingtaking")){
do(this, "beforetringtaking")
}
// Check if the beforetryingtaking script set cantake to false before calling beforetaking
if(this.cantake) {
if (HasScript(this, "beforetaking")){
do(this, "beforetaking")
}
}
// Check if anything has set cantake to false before trying to take
if(this.cantake) {
// Can't do this! It will just call this script, creating an infinite loop
DoTake(this)
} I think I'd have to modify I'm trying to help port an Inform 7 game to Quest. A few of the objects in this game use:
Quest's Before trying taking the lamp when the lamp is not carried by the player and the stick is carried by the player:
say "You reach out with the stick and...".
Before taking the lamp when the location is the waterfall and the lamp is not carried by the player:
if the stick is carried by the player:
say "...you manage to get it under the handle just enough, and...";
else:
say "You can't reach it." instead.
After taking the lamp for the second time:
say "Taken. Again. (Only a fool would drop such a thing in the first place!)".
There are about 20 objects in this game that use "before trying taking" and "before taking", too. So, I really would like to just modify |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think the easiest way to do this would be including it in Something like…
This is a bit more complex than it needs to be, but I think includes a few guards to avoid creating gotchas for users who make assumptions about how to use it. An object's If an object has a permenant I also made it so that if the Hope that makes sense. I thought this seems like an interesting enough situation to merit a more flexible solution. |
Beta Was this translation helpful? Give feedback.
I think the easiest way to do this would be including it in
TestTakeGlobal
.Something like…