xboxscene.org forums

Author Topic: Writing Reserved Characters  (Read 94 times)

Mordenkainen

  • Archived User
  • Sr. Member
  • *
  • Posts: 447
Writing Reserved Characters
« on: November 26, 2003, 09:02:00 AM »

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.

This post has been edited by Mordenkainen: Nov 26 2003, 05:07 PM
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
Writing Reserved Characters
« Reply #1 on: November 26, 2003, 09:04:00 AM »

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)
Logged

Mordenkainen

  • Archived User
  • Sr. Member
  • *
  • Posts: 447
Writing Reserved Characters
« Reply #2 on: November 26, 2003, 09:08:00 AM »

Thanks BJ!

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

Morden.
Logged

Mordenkainen

  • Archived User
  • Sr. Member
  • *
  • Posts: 447
Writing Reserved Characters
« Reply #3 on: November 28, 2003, 10:50:00 AM »

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.

This post has been edited by Mordenkainen: Nov 28 2003, 06:53 PM
Logged