|
Nibbles Beginner
Joined: 01 Aug 2004 Posts: 15
|
Posted: Sat May 21, 2005 3:32 pm
Problem with special characters and %read? |
All right, I'm attempting to right a Wizard/eScape script emulator for simutronics users in zMUD. To load the files, I'm using the #FILE and %read command and function, the relevant portion follows:
Code: |
\clearscript
#FILE 1 %1
#VAR __iter {1}
#VAR __filesize {%filesize( 1)}
#WHILE (@__iter <= @__filesize) {
#VAR __nextline {%read( 1)}
|
Now, one of the files might look like this.
However, the line #VAR __nextline {%read( 1)} is setting @__nextline equal to "put say Hello 1!". The % sign is disappearing.
I've tried encompassing the %read with a %quote, but that doesn't do anything. Does %read itself strip special characters, and if so, why?
Any assistance on how to make this work would be appreciated. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun May 22, 2005 1:26 am |
Were you after the specific emulation of the wizard language, or just the reading-from-a-file format?
Assuming the former, you'll probably have to convert your filereader from %read() to #READ. #READ has a _noexpand option that will keep %1 and other variables intact but to do any processing on each line you'll have to create aliases of all the wizard script commands.
Assuming the latter, you could build an interactive interface to make things easier on the user. I kind of like this idea, so maybe I'll take a crack at it as well (I've got a few other uses in mind, so it won't totally be reinventing the wheel). |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Nibbles Beginner
Joined: 01 Aug 2004 Posts: 15
|
Posted: Sun May 22, 2005 4:25 am |
Thank you, that solution worked. I created a (*) command trigger and just turned it on to read the line, then turned it right back off:
Code: |
#WHILE (@__iter <= @__filesize) {
#T+ _WizardScripts_CatchLine
#READ 1 _noexpand
#T- _WizardScripts_CatchLine
#MATH __iter {@__iter + 1}
}
|
All the parsing goes on in there. I've got it working now with put and echo, I just need to write all the other commands. |
|
|
|
|
|
|
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
|
|