Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Zene
Beginner


Joined: 10 Jul 2002
Posts: 26
Location: Canada

PostPosted: Tue Aug 20, 2002 3:44 am   

Reading files question..
 
Hey I was wondering if there is a way to read the same line from a file again...
like for example in my script...
it walks around..but sometimes it has to try to go into the direction a few times because my swim/climb skills are low in %..so i would like it to re-read the previous direction read from the file...i read the help files..but didn't find anything that might work in this manner...
But I just realized, as I am typing this that I can make a variable and fill it up with the last command :)..hehe..but any help to original question would still be appreciated..
Reply with quote
Burser
Wanderer


Joined: 07 Feb 2001
Posts: 70
Location: United Kingdom

PostPosted: Tue Aug 20, 2002 4:06 am   
 
I'm no expert on this, but if the read-system works like most things, the file pointer can only move down or reset.

---> Burser

|## - The flags have it.
Reply with quote
Zene
Beginner


Joined: 10 Jul 2002
Posts: 26
Location: Canada

PostPosted: Tue Aug 20, 2002 3:14 pm   
 
hehe...well...the idea sounds great..but i'm not sure how to implement it.

Does anyone have any ideas on how i can read the file into a variable...like line by line...
The only thing i can think of is to put a #var varname {<contents of line in file>} at every line...
But the script files do tend to be very big, so i was hoping someone else had an easier solution..
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Aug 20, 2002 7:29 pm   
 
quote:

Syntax: #REA filename

#REA n [rec] _noexpand
#REA n [rec] [arguments]

Open the file given by filename and read it line by line, executing each line. This allows you to store commands in a script file and then execute this script. Typically the KILLALL command will be used to clear memory before reading the file.
The second form of this command reads data from the nth file (opened with the FILE command). If n is 1-5, then the file is a text file and rec is the line number to read. If rec is zero or omitted, the next sequential line is read.



Unless I'm missing something

An alias can do:
#READ 1 @V_ThisLine
#ADD V_ThisLine 1

Then you have a trigger modify the location
You try to swim but don't as your big toe found it too cold.
#ADD V_ThisLine -1

If that is timed properly it will re-read the swim direction.

Ton Diening
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net