money system

Anonymous
04 Jun 2004, 23:28
Im new to qdk and im wandering if there is a way to setup a system where you can loose, and gain money without adding extra objects to your inventory. For example, in this game you sell an item. I want it in your inventory to say something like "200 dollars", instead of having to make you gain 200 "money" and have your inventory fill up with items called "money". Another example, you buy a sword, i want your "200 dollars" to become "1 dollar".

Is there a way to do that?

Anonymous
05 Jun 2004, 03:43
What you could do is have a numerical variable called “money” so you could just keep a running total. Then create an object called “200 dollars” in the room, run a script so that when a player take that object it become inaccessible and the money variable increases by 200.


' "test"
' Created with QDK Pro 3.52

define game <test>
asl-version <350>
gametype singleplayer
start <room>
game info <Created with QDK Pro 3.52>
define variable <money>
type numeric
value <0>
display nozero <you have ! dollars cash>
end define
end define

define synonyms
end define

define room <inventory>
end define

define room <room>

define object <200 dollars>
take {
inc <money; 200>
hide <200 dollars>
}
end define

end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define


Anonymous
05 Jun 2004, 15:55
thx

Anonymous
05 Jun 2004, 15:55
thx

paul_one
05 Jun 2004, 20:27
Erm, instead of:

display nozero <you have ! dollars cash>


Use:

display nozero <you have ! dollar*s* cash>



As this means when you get to 1 you get "you have 1 dollar" instead of "1 dollars"...