Character Selection Help
Author |
Message |
4525Programmer
|
Posted: Thu Jun 19, 2014 12:14 pm Post subject: Character Selection Help |
|
|
What is it you are trying to achieve?
I am trying to program a small rpg game on turing.
What is the problem you are having?
I am having some trouble with the character selection, with writing the gender to a file.
Describe what you have tried to solve this problem
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing: |
import GUI
View.Set ("graphics:360;400,nobuttonbar")
var gender : string
var fileName : string := "gendern"
var fileNo : int
proc genderchange1 (x : boolean)
locate (1, 1)
put "You are a guy?"
gender := "Male"
end genderchange1
proc genderchange2 (x : boolean)
locate (1, 1)
put "You are a girl?"
gender := "Female"
end genderchange2
proc submit (x : int)
open : fileNo, fileName, write
write : fileNo, gender
end submit
var cm := GUI.CreateCheckBox (30, 330, "Male", genderchange1 )
var cf := GUI.CreateCheckBox (30, 310, "Female", genderchange2 )
var b1 := GUI.CreateButton (30, 330, "Submit", submit )
loop
exit when GUI.ProcessEvent
View.Update
exit when hasch
end loop
|
Please specify what version of Turing you are using
Latest |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Srlancelot39
![](http://compsci.ca/v3/uploads/user_avatars/208361363253ae43a498500.gif)
|
Posted: Thu Jun 19, 2014 1:11 pm Post subject: Re: Character Selection Help |
|
|
Turing: |
proc save
open : filevariable, "Save File.txt", write %you can actually make up your own file extension, it will work as long as you don't manually alter the contents (use .txt to be safe though)
write : filevariable, data1, data2, datax, etc
close : filevariable
end save
|
You seem to have everything correct in comparison to my working code. The only difference is you're not closing the file. Try adding that and see if it works. |
|
|
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: Thu Jun 19, 2014 10:53 pm Post subject: RE:Character Selection Help |
|
|
Turing: |
var fileName : string := "gendern"
|
Is your file called gendern? Is that the full name of the file, do you think? |
|
|
|
|
![](images/spacer.gif) |
|
|