Money

i am new so i need some help

what i am trying to do is

In the library i see Lisa she gives me $25

in the kitchen i buy a cheese cake for $5

when i click on inventory it shows how much i have..


Do you want to use the built in money system? On the 'game' object's 'Player' tab, there's a tickbox for "Show money". Then you can easily handle money.

In the library i see Lisa she gives me $25

So in the script for Lisa's conversation, you'd have the line:

IncreaseMoney (25)

in the kitchen i buy a cheese cake for $5

The script for this would be something like:

if (game.pov.money < 5) {
  msg ("Cheesecakes are $5, but you only have {=DisplayMoney{game.pov.money}.")
}
else {
  DecreaseMoney (5)
  AddToInventory (cheesecake)
  msg ("You buy a cheesecake for $5.")
}

when i click on inventory it shows how much i have.

By default, the player's money shows up in the status pane. But it's not too hard to make it show up in the inventory if you'd prefer it there. You just give the player a "money" object. You'd want to make it initially invisible if the player doesn't have any money, but put it inside the player anyway.

Then to make the money visible, you'd change it when the player gains money. So you'd give the player object a script attribute named changedmoney - Quest will automatically run this script when the player's money changes. The script would be something like:

if (this.money = 0) {
  money.visible = false
}
else {
  money.visible = true
  money.alias = DisplayMoney(this.money)
}

Log in to post a reply.

Support

Forums