Im sitting here trying to write and incorporate a carrying capacity system relying on weight instead of capacity. However i’m getting some weird numbers, when i try to work with the total of a numeric property.
This is how i define weight:
A weight is a kind of value.
1.0 kg specifies a weight.
Everything has a weight.
A thing usually has a weight 0 kg.
A person usually has a weight 80 kg.
The carrying capacity of the player is 999.
A person has a weight called Carry Limit. The Carry Limit of a person usually is 20 kg.
My first attempt for saying the total weight of items carried by the player looked like this:
To say Carry Weight of the player:
let cw be the total weight of things carried by the player;
say "[cw]".
This gave me weird numbers when carrying more than 1 item:
------------------
Carry/Weight
------------------
Limit: 20.0 kg
Weight: 1.70141 × 10^38 kg
------------------
Inventory
------------------
two Demonic Daggers
Both daggers have a weight of 1 kg. Which is why it don’t makes sense.
So i tried doing something inspired by the examples provided in Inform doc:
To decide what weight is the Carry Weight of the player:
let sum be the total weight of things carried by the player;
decide on sum.
This gave me the same results from before.
The overall overburdened system looks like this, though i don’t think it’s super relevant:
Every turn:
if the total weight of things carried by the player is greater than the Carry Limit of the player:
if the player is not-overburdened:
now the player is overburdened;
otherwise:
[else if the total weight of things carried by the player is less than the Carry Limit of the player:]
if the player is overburdened:
now the player is not-overburdened.
A scene can be sc-overburdened or sc-underburdened.
Instead of going somewhere during a sc-overburdened scene:
say "You are currently carrying too much and overburdened, drop something!".
Every turn during the Overburdened-by-weight, say "You are still overburdened by weight!".
When Overburdened-by-weight begins:
say "You are currently carrying too much and overburdened, drop something!".
When Overburdened-by-weight ends:
say "You are no longer overburdened by weight!".
Overburdened-by-weight is a sc-overburdened recurring scene.
Overburdened-by-weight begins when the player is overburdened.
Overburdened-by-weight ends when the player is not-overburdened.
Anyone got any ideas why total doesn’t work with weight values?