Talk:How do I make a Bank where you can store money/items?

Jump to navigation Jump to search

raekuul: This sounds like it could be done in PS using globals, but I'm not entirely sure...

Mike: It could, the problem is the interface.

If you use 255 globals for each type of item (the globals store how many are in the bank), and two for money (high and low of the Long int)

But, I have no clue as to how you'd present this to the user and ask what and how many they want to deposit or withdraw.

raekuul: I'm typing this from memory in Basic, but here goes...

PRINT "press a to deposit item, b to deposit money"

INPUT "q to quit", $x

IF $x="a" then GOSUB Objects else

IF $x="b" then GOSUB Bank else


SUB Objects

INPUT "please input Item Number", a


end sub

SUB Bank

Input "please input value", b...

You get the Idea, right? I see what you mean, though... through PS, there's a) no interface and b) virtually no error-checking.

Mike: Yes, that's roughly how it would look in BASIC. However, Plotscripting uses HamsterSpeak.

Andrusi: How's this? I don't have the patience to work out the items version, but that's mainly just a matter of adding a way to pick which global you're saving to.

Andrusi: GAAAH! No, don't do that, it'll wipe out your money if you have more than $32767! Fixing...

Bis_Senshi As I was implementing it for one of my game, I discovered a little mistake. Hspeak.Exe was complaining about goldvar<32767 (line8 plotscript bank). I replaced it by "goldvar <=32767" Now it compiles and works perfectly! I