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

Username:   Password: 
 RegisterRegister   
 Searching a File
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Arrghus




PostPosted: Wed Jan 10, 2007 10:09 am   Post subject: Searching a File

I need to make a game for my Programming summative, and I'm making a combat system.

One of the parts I wanted to incorporate was spells, and I thought a sort of spell database would be the best way to achieve this.

The thought I had was that it would look through a file for the name of the spell, and from that point read the data that makes the spell work, and then cast it using this data. An example of a spell I've made is:

Cure
1
8
-30
-3
1A
None

The format being:
Name
Level
MP Cost
Damage
Damage Threshold
Target
Status Effect

Is there a way I can do this?
Sponsor
Sponsor
Sponsor
sponsor
ericfourfour




PostPosted: Wed Jan 10, 2007 4:53 pm   Post subject: Re: Searching a File

Let me get you started:
Turing:
type Spell :
    record
        %insert variables for the spell
    end record

function readSpell (fileName : string) : Spell
    %Make the spell
    result %The new spell
end readSpell


Within the Turing Walkthrough, you will be able to find tutorials on records, functions, and file io.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: