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
bites #success verb
bite #fail verb
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
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