Jump to content


Photo

Writing Reserved Characters


  • Please log in to reply
3 replies to this topic

#1 Mordenkainen

Mordenkainen

    X-S Freak

  • Members
  • PipPipPipPipPip
  • 1,291 posts
  • Xbox Version:v1.3

Posted 26 November 2003 - 04:55 PM

I have been trying to write a script that uses the file operations (Not the xml ones, though I will also want to use those in the future). The issue I have is I am writing a little piece of script out to the file. Since it is an actionscript it has %'s and "'s and such all over the place. These characters do not seem to get written to the output file even if I double them up...

Examples:

writefileln "Test %test%"

Outputs:
Test
(This is expected as %test% is undefined)

writefileln "Test %%test%%"

Outputs:
Test %

Where did the rest of the text go?

Just to try stuff I tried:
"Test \%test\%"
"Test %%%test%%%"

and several other combinations, none worked....

Though:
writefileln "Test %test"

Did output:
Test %test

but:
writefile "Test %test"
writefile "%"

Output:
Test %test
%
(see my note below)


As this is Actionscript I am outputting I will need to be able to write out these characters. As well as a few others..

Also as I side note, I noticed that WriteFileLN and WriteFile do the same thing, both put a newline on the end, so:

WriteFile "Test"
WriteFile "ing"

Outputs:
Test
ing

as opposed to "Testing" as the documentation would suggest.

Can anyone help me out here?

Morden.

Edited by Mordenkainen, 26 November 2003 - 05:00 PM.


#2 BenJeremy

BenJeremy

    X-S Elysian

  • Head Moderators
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 9,690 posts
  • Gender:Male
  • Xbox Version:v1.1
  • 360 version:v1 (xenon)

Posted 26 November 2003 - 04:57 PM

I'll have to check into that... lucky for you guys I've got a long weekend with no travel plans (well, except for Thanksgiving day itself)

#3 Mordenkainen

Mordenkainen

    X-S Freak

  • Members
  • PipPipPipPipPip
  • 1,291 posts
  • Xbox Version:v1.3

Posted 26 November 2003 - 05:01 PM

Thanks BJ!

You replied before I was even done editing out my mistakes!

Morden.

#4 Mordenkainen

Mordenkainen

    X-S Freak

  • Members
  • PipPipPipPipPip
  • 1,291 posts
  • Xbox Version:v1.3

Posted 28 November 2003 - 06:43 PM

Ok here is what I have figured out so far:

Doubling up % it " in a string doesn't seem to work, The string usually gets terminated at the doubled character.

I have tried several other ways to assign " characters to a string (preceding with \ etc.). % can be assigned as long as there are not two of them surrounding text (I.E. %text%)

If you load a character from a file (say a file that only has one line: "), you can then use that variable in place of the character. This works but is an ugly hack.

CODE

 openread testfile e:\mxm\test.txt
 readfileln testfile testvar
 closefile testfile
 set testvar "%testvar%test%testvar%"
 callscript _displaymessagebox %testvar%


Hope this helps!

Morden.

Edited by Mordenkainen, 28 November 2003 - 06:46 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users