Problems with writing a file
Author |
Message |
NotNemesis
|
Posted: Mon Dec 29, 2014 7:39 pm Post subject: Problems with writing a file |
|
|
What is it you are trying to achieve?
Write a .txt file with each line being a different variable.
What is the problem you are having?
Data does not write to file.
Describe what you have tried to solve this problem
Using tutorials on compsci.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
To test the code, you need a blank .txt file named rpgsave.txt
Turing: |
% File Writer for RPG
% by NotNemesis
var lv, hp, mp, a, d, ma, md, s, l : int % Player stats
%Order of stats in file : Level, HP, MP. Attack, Defence, Magic Attack, Magic Defence, Speed, Luck
lv := 1 % Level
hp := 10 % HP
mp := 5 % MP
a := 6 % Attack
d := 4 % Defence
ma := 3 % Magic Power
md := 3 % Magic Defence
s := 4 % Speed
randint (l, 1, 3) % Luck
procedure sv % Save procedure
var file : int
open : file, "rpgsave.txt", put
loop
exit when eof (file )
get : lv, hp, mp, a, d, ma, md, s, l % Getting vars
put : lv, hp, mp, a, d, ma, md, s, l % Writing vars
close : file
end loop
end sv
put "Saved!"
|
Please specify what version of Turing you are using
Turing 4.1.1 |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Zren
|
|
|
|
|
|
|