Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Character Selection Help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
4525Programmer




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Srlancelot39




PostPosted: 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.
Raknarg




PostPosted: 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?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: