"put" command not working as intended [solved]

I have it set up so that you have a side bag that rests in your inventory and you can put things in it and take them out. I also set it up so that if you drop anything it goes straight to the bag. for some reason the put command stopped working. as an example, there is a desk in my game with a note on it. you can take the note and drop it. dropping it places it in your bag, but typing put note in side bag just returns with nothing. no response at all. and it's still in the inventory. when I turn dropping off for the note it says I can't place it in the bag, which means the script works, but isn't. I have a command that goes by the same name but it started to not work a while after I had the command up and running. what is the problem?


Could you provide us with a test game where we can see the problem


Mr. Parser

The beginning of the put command's script:

// put object1 in/on object 2
canbedropped = true
if (HasBoolean(object1, "drop")) {
  if (not object1.drop) {
    canbedropped = false
  }
}
if (object1.parent = object2) {
  msg (DynamicTemplate("AlreadyThere", object1))
}
else if (not ListContains(ScopeInventory(), object1)) {
  msg (DynamicTemplate("NotCarrying", object1))
}
else if (not canbedropped) {
  msg (DynamicTemplate("ObjectCannotBeStored", object1))
}

...and later in that same script:

  else if (HasScript(object1, "drop")) {
    do (object1, "drop", params)
  }

The drop attribute directly effects put.


In every game I've ever worked on I have ended up overriding the PUT command. The main reasons have been that I wanted to (i) allow 'into' as well as 'in' (e.g. put 'toy into box' is what I would normally say); (ii) add synonyms for 'put' such as 'insert'; and (iii) make sure that 'put' didn't work unexpectedly with random objects and containers, giving the impression it was meaningful.

From the discussion in this thread and a little experimentation, I can probably add three more reasons for overriding PUT: (iv) prevent use of 'on' ('put toy on box' and 'put toy in box' seem different to me?); (v) provide more specific messages when objects can't be dropped (could use drop message if one has been provided?); and (vi) allow objects to be taken and put into containers in one operation, rather than having to pick them up first (e.g. 'put apple into knapsack' when the player is carrying the knapsack and enters a location where there is an apple).


The drop attribute directly effects put.

This is because the drop script may not allow the object to be dropped.

Suppose there is a cursed ring that cannot be dropped until the curse is lifted. You could handle that with a "drop" script on the ring; if the curse has been lifted the ring is dropped, otherwise not. So far so good.

What if the player puts the ring in a chest in the room? Should Quest just allow it? No - that would let the player avoid the curse. Instead, Quest lets you the author handle it, by running the "drop" script.

If the script is set up properly, then when the curse is lifted, the ring is not automatically put in the room, but is moved to the object specified by "destination":

if (player.curselifted) {
  this.parent = destination
  msg (Template("Done"))
}
else {
  msg("Some arcane power is stopping you let go on the ring.")
}

Exactly what is happening in your case I am not sure, but PUT is working as it is designed to.


I tried to put the note in the bag when it's on the table and it said you are not carrying the note, so it must be running into a problem with something when attempting to move the object into the bag. I'm new to quest but I have some knowledge of programming. the bag cannot be dropped, but the note can. it has nothing to do with the type of container the bag is, since I switched it from container to surface and got the same results. I don't know how to make a test game without publishing it and I can't copy the game, so i'll give you all some info about the bag and command.

The bag command is named SideBag and the command is "side bag #text#". This is it's code:

if (text = "progress") {
}
else if (text = "help") {
  msg ("<u>Side Bag Commands</u><br/> - progress: lets you see what chapter you are on<br/> - achievements: shows your Achievements<br/> - journal: lets you save your game<br/> - pocket watch: shows you how long you have been playing for.<br/> - items: Shows you what is in the bag without the description")
}
else if (text = "journal") {
}
else if (text = "achievements") {
}
else if (text = "items") {
  msg ("My bag contains" + GetDirectChildren(SideBag1))
}
else if (text = "pocket watch") {
  msg ("not working at the moment")
}
else {
  msg ("I don't understand your command. Type \"side bag help\" for commands. note that the commands are case sensitive, so commands should be all lowercase.")
}

the bag is named SideBag1 and it's alias is Side Bag. it's an open container that cannot be opened or closed and doesn't lock.


nevermind i'm removing the bag. please do not respond to this topic


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

Support

Forums