Quick, Hopefully simple question

Talon
25 Mar 2016, 22:11
Hopefully this is a simple question, I want to make a bag, making it a limited container is simple enough, but I'd also like it to change with the amount of items inside it, bulging to near bursting when full rather than just showing some heft when half full

Essentially I'm looking for a function or script that could count the number(or volume) of objects inside and output text based on how closer to capacity the item is.

Thank you for all the help this forum has given me since i started to use the program

HegemonKhan
25 Mar 2016, 22:42
using 'volume', a quick-brief example:

<object name="bag">
<attr name="alias" type="string">bag</attr>
<attr name="changedvolume" type="script">
if (bag.volume > 1000) {
bag.alias = "near-bursting bag"
} else if (bag.volume > 500) {
bag.alias = "bulging bag"
} else {
bag.alias = "bag"
}
</attr>
</object>


using item quantity, a quick-brief example:

<object name="bag">
<attr name="alias" type="string">bag</attr>
<attr name="item_quantity" type="int">0</attr>
<attr name="changedvolume" type="script">
count = 0
foreach (object_variable, GetDirectChildren (bag)) {
count = count + 1
}
bag.item_quantity = count
</attr>
<attr name="changeditem_quantity" type="script">
if (bag.item_quantity > 10) {
bag.alias = "near-bursting bag"
} else if (bag.item_quantity > 5) {
bag.alias = "bulging bag"
} else {
bag.alias = "bag"
}
</attr>
</object>


--------

laughs... I just remembered that 'ListCount' exists, lol... I haven't been using quest for awhile due to school/school work, lol

(well my example above, shows how 'ListCount' works/is probably generally done underneath by quest... lol)

using item quantity (using ListCount), a quick-brief example:

<object name="bag">
<attr name="alias" type="string">bag</attr>
<attr name="item_quantity" type="int">0</attr>
<attr name="changedvolume" type="script">
bag.item_quantity = ListCount (GetDirectChildren (bag)) {
</attr>
<attr name="changeditem_quantity" type="script">
if (bag.item_quantity > 10) {
bag.alias = "near-bursting bag"
} else if (bag.item_quantity > 5) {
bag.alias = "bulging bag"
} else {
bag.alias = "bag"
}
</attr>
</object>