Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualgame of thought

Posted 28 February 2013 - 02:34 PM

for a while in my text based game, monsters have been loaded via random variables applied to lists and that are therefore generated.

 

However, for a while i have wondered how i could have all the monster attributes in an easily modifiable text file containing all the data.

 

i know how it will work, what it do is for example, i will call foo.txt

 

Rabbit

30#hp

5#attack

bites #success verb

bite #fail verb 

 

rat

40

10

nibbles

nibble

 

the trouble is that i don't know what function to use as some of the information from help() is vague about arguments.

 

what i am looking for is a function that looks at one of these random variables and can move the reader 'head' to the exact file line specified by the random variable

 

e.g.

say i wanted to load rabbit:

function_name(1) #since rabbit is the first line of foo.txt

 

is there a function like this?

if not, how do i replicate a function like this to put inside my game? not in terms of parameters etc. just what combination of function calls and loops etc do i need?  

 

 

thanks a million

 

edit: it is python


#1game of thought

Posted 28 February 2013 - 01:56 PM

for a while in my text based game, monsters have been loaded via random variables applied to lists and that are therefore generated.

 

However, for a while i have wondered how i could have all the monster attributes in an easily modifiable text file containing all the data.

 

i know how it will work, what it do is for example, i will call foo.txt

 

Rabbit

30#hp

5#attack

bites #success verb

bite #fail verb 

 

rat

40

10

nibbles

nibble

 

the trouble is that i don't know what function to use as some of the information from help() is vague about arguments.

 

what i am looking for is a function that looks at one of these random variables and can move the reader 'head' to the exact file line specified by the random variable

 

e.g.

say i wanted to load rabbit:

function_name(1) #since rabbit is the first line of foo.txt

 

is there a function like this?

if not, how do i replicate a function like this to put inside my game? not in terms of parameters etc. just what combination of function calls and loops etc do i need?  

 

 

thanks a million

 

 

 


PARTNERS