2019-03-25 17:27:18 -04:00

23 lines
605 B
Plaintext

ENTRY INIT
USING filesystem as bin
[INIT]{
size = bin.fileExist("StoryTest/data.dat")
if size!=True then JUMP("CREATEDATA")|JUMP("HASDATA")
}
[CREATEDATA]{
"We have no data! Let's create it!"
name = getInput("Please Enter your name: ")
file = bin.new()
file:addBlock(name,16) //Name
file:addBlock(100,4) //Money
file:addBlock("START",16) //Current Label
file:tofile("StoryTest/data.dat")
JUMP("HASDATA")
}
[HASDATA]{
file = bin.load("StoryTest/data.dat")
name = file:getBlock("s",16)
money = file:getBlock("n",4)
label = file:getBlock("s",16)
"Name: $name$ Money: $money$ Label: $label$"
}