Accumulative Items

Zepeus
How do I have accumulative objects such as gold or arrows using the GUI? I just can't figure out how. I've tried using the "Increase Object Counter" and "Decrease Object Counter" scripts, but I can't seem to get them to work. I can always have the score for gold, but it just doesn't seem right, and you couldn't use it for arrows (well you could, but you'd only be able to have gold OR arrows, but not both :? ). Plz help me! :cry:

Sora574
You can use my library (click here)
Just make sure you run the 'Enable stack' script in your start script. This basically enables all of the behind-the-scenes functionality.
If you need me to explain anything, just let me know.

Zepeus
Sorry, didn't realise new update was out, to busy making text adventures... :twisted:
Stupid Windows computers... Can't manage to simply update Quest... :x
P.S. Is that script in the update or am I missing something?
P.P.S. Can't believe I haven't seen a whole Quest update since May 5th... :oops:

Sora574
I'm not sure what you're talking about... If you're asking if my library was included in the update, no. You can get it here, though.

Zepeus
Whooaa, man I just confused myself and everyone else, :oops: , thought that your library and the script were 2 different things, the script (I thought) was part of the update, but I can't use or even understand code language, so didn't get that your library was actually that script. Sorry. :oops:

cole
Hello, I'm completely new to Quest and I do not know much about coding so I only use the (rather superb) GUI.
I just thought I post my way of combining objects into stacks and see if anybody can either use it or even better (for me) tell me how my system can be improved or if it contains any errors or cases I haven't foreseen.

I basically just modified the "take", "drop", "removefrom" and "put" commands as well as the "DoTake" and "DoDrop" functions so that if you use them objects will stack as long as you give them the appropriate attributes as explained in the file attached to this post (there is a "help" command explaining how to set up stackable objects).
I did not use a turn script for my system since I wanted the player to be able to divide stackable objects into seperate stacks and with a turn script they would be combined again right after the player splits them.
How to split and combine objects into stacks is pretty self-explanatory I believe.


The following is purposely set up this way since it seemed to be the most logical to me:

Objects stack if the player:
- picks up an object and already has one of its kind in his inventory
- removes an object from a container and already has one of its kind in his inventory (technically the same as taking the object out of the container)
- drops an object and one of its kind is already on the floor
- puts an objects to a place where another one of its kind is already located

Objects do not stack if the player:
- picks up an object and has one of its kind in the inventory, but in a container (i.e. a bag)
- drops an object and one of its kind is in the room, but in a container (i.e. a chest)
- picks up a container which contains another object (i.e. a small bag contains a potion, you pick up the small bag)

Complex cases:
- putting an object inside a container which itself is inside a container and one of the containers contains an object of the same kind (i.e. a small bag contains a potion, the small bag is inside a large bag)
- if you put a potion inside the large bag, then it will not stack with the potion in the small bag
- if, one the other hand, you put the potion in the small bag, then it will stack

I apologize for any grammatical shortcomings, but English is not my mother language. The programming is still in English though so that shouldn't be a problem. :D

Entropic Pen
Zepeus wrote:How do I have accumulative objects such as gold or arrows using the GUI? I just can't figure out how. I've tried using the "Increase Object Counter" and "Decrease Object Counter" scripts, but I can't seem to get them to work.


What are those scripts used for anyhow?

HegemonKhan
if you mean the "IncreaseObjectCounter" and "DecreaseObjectCounter", they are "addition" and "subtraction" scripts:

Object.Attribute = Object.Attribute + Value
Object.Attribute = Object.Attribute - Value

though, they're written with the Value of "1". So, they're not too useful when you need the Value to be something else, though you can change them, by:

Filter -> Show Library Elements -> (?Functions? ~ not sure what category they're under, meh) -> "IncreaseObjectCounter" and~or "DecreaseObjectCounter" -> Copy -> (alter it, but this is a global as it is a core script change...)

... it is easier to just directly do the script, lol:

Run as a script -> Add a~new script -> Variables -> Set a variable or an attribute ->

Object.Attribute = Object.Attribute + Value
~OR~
Object.Attribute = Object.Attribute - Value

stanleythewhale

Run as a script -> Add a~new script -> Variables -> Set a variable or an attribute ->

Object.Attribute = Object.Attribute + Value
~OR~
Object.Attribute = Object.Attribute - Value



Thanks, HegemonKhan. I've been banging my head against the wall trying to define variables when object attributes worked perfectly on the first try. :D

StW

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

Support

Forums