Jump to content


Photo

WRITE_ASCII offset ~%variable%~


  • Please log in to reply
2 replies to this topic

#1 Idobek

Idobek

    Pocket Plane Gibberling

  • Member
  • 429 posts

Posted 04 October 2003 - 06:17 AM

Thanks to Japheth we can now READ_ASCII. I would like to be able to use this in conjuction with WRITE_ASCII. However currently WRITE_ASCII does not take variables.

READ_ASCII offsetA "variable"
WRITE_ASCII offsetB ~%variable%~

It would also be nice if READ_ASCII variables could be used by WHILE and IF_EVAL. Only an equality value would be required.

READ_ASCII offsetA "variable"
WRITE_ASCII offsetB ~newtext~
IF_EVAL NOT ("%variable%" = ~FOO~)

Thank you.

#2 weimer

weimer
  • Member
  • 1569 posts

Posted 06 October 2003 - 09:53 PM

Many people expect WRITE_ASCII to write literal text, but I'll add a WRITE_EVALUATED_ASCII for you. Look for it in the next version.

READ_ASCII should work fine in WHILE and IF_EVAL. Can you give an example of code that fails?

#3 Idobek

Idobek

    Pocket Plane Gibberling

  • Member
  • 429 posts

Posted 07 October 2003 - 04:09 AM

Many people expect WRITE_ASCII to write literal text, but I'll add a WRITE_EVALUATED_ASCII for you. Look for it in the next version.

Thank you.

READ_ASCII should work fine in WHILE and IF_EVAL. Can you give an example of code that fails?

I assumed I was wrong here and went back and checked my code. However, I can't make it work. An example:

COPY_EXISTING ~c6catti.cre~ ~override/c6catti.cre~
  READ_LONG "0x2bc" "itemsoffset"
  READ_LONG "0x2b8" "itemslot"
  READ_SHORT ("%itemslot%" + 0x12) "weapon1"
  READ_ASCII ("%itemsoffset%" + "%weapon1%" * 0x14) ~oldbow~
      WRITE_ASCII ("%itemsoffset%" + "%weapon1%" * 0x14) ~NEWBOW01~
  IF_EVAL ("%oldbow%" = "CATTIBOW")

I've tried with various combinations of ~~ and "" around the variables in case that was the problem, but the result is always:

ERROR: cannot convert ~%oldbow%~ (or ~CATTIBOW~) to an integer

I haven't tried with WHILE yet.