Pocket Plane Group Logo The Red Wizard Extraordinaire romance mod
Welcome, Guest. Please login or register.
March 17, 2010, 09:50:13 PM

Login with username, password and session length
Search:     Advanced search
The Fields of the Dead v1.07 released! Download here.
131366 Posts in 13310 Topics by 3849 Members
Latest Member: Kilmor of Gelnor
* Home Help Search Login Register RSS feed
+  Pocket Plane Group
|-+  Friends and Neighbors
| |-+  Weimer Republic (WeiDU.org)
| | |-+  WeiDU (Moderators: weimer, the bigg)
| | | |-+  SPRINT strref discrepancy
« previous next »
Pages: [1] Go Down Reply Print
Author Topic: SPRINT strref discrepancy  (Read 334 times)
Miloch
Barbarian
Planewalker
*****
Offline Offline

Gender: Male
Posts: 565



« on: January 29, 2010, 11:36:10 PM »
Reply with quote

Code:
SPRINT myvar @123
WRITE_ASCIIE offset ~%myvar%~
works fine (let's say myvar = Text, then it writes Text at the offset)
Code:
SPRINT myvar #123
WRITE_ASCIIE offset ~%myvar%~
Does not - it writes ~Text~ at the offset. %myvar% and myvar do not evaluate the variable (it writes myvar at the offset rather than Text). "%myvar%" writes ~Text~ as well, oddly enough (even though the quotes are differnt).

Yes, I suppose I could avoid it via (even more) hackery by looking up and writing the hardcoded strref to the .tra file. Rather redundant though... gods forbid I have a mod with 5 or 6 translations where I have to do that. A simple WRITE_STRREF command might avoid even the SPRINT hackery.
Logged

wut
Guest
« Reply #1 on: January 29, 2010, 11:59:20 PM »
Reply with quote

GET_STRREF 123 myvar

Generally you want to be writing the string number rather than plain text in binary files, however - you sure you don't want WRITE_LONG offset 123 or SAY_EVALUATED offset ~%myvar%~?

%myvar% never evaluates variables.
Logged
wut
Guest
« Reply #2 on: January 30, 2010, 01:50:31 AM »
Reply with quote

Incidentally,
Code:
SPRINT myvar #123
WRITE_ASCIIE offset ~%myvar%~
will write "Haer' Dalis, all of you, stop them!", just as it should. You may want to post the code you're really using.
Logged
Miloch
Barbarian
Planewalker
*****
Offline Offline

Gender: Male
Posts: 565



« Reply #3 on: January 30, 2010, 07:19:13 AM »
Reply with quote

GET_STRREF works, cheers. Yes, I want the actual text, not the strref.
Incidentally,
Code:
SPRINT myvar #123
WRITE_ASCIIE offset ~%myvar%~
will write "Haer' Dalis, all of you, stop them!", just as it should.
No, it writes ~Haer'Dalis, all of you, stop them!~ (tildes included). Or it cuts it off around the last word with no closing tilde if you put a #32 after it. Now try putting it in a .tra file and use @123 (or whatever) instead. No tildes, so it's clearly reading them for hardcoded strings (why, I don't know) but not traified ones.
Quote
You may want to post the code you're really using.
Not really Tongue. Since I'm working with my own files, it wouldn't help much anway. But if you want an example that *isn't* my code, do something like this:
Code:
COPY_EXISTING ar0020.are override
  READ_LONG 0x54 act_off
  READ_SHORT 0x58 act_num
  FOR (i = 0; i < act_num; i += 1) BEGIN
    READ_ASCII (i * 0x110 + act_off) act_name
    PATCH_IF (~%act_name%~ STRING_EQUAL ~Soldier~ = 1) BEGIN
      SPRINT new_name #123
      WRITE_ASCIIE (i * 0x110 + act_off) ~%new_name%~ #32
    END
  END
BUT_ONLY
(I don't care if the "Name" field here isn't really used - it's an example.)
Logged

the bigg
The Avatar of Fighter / Thieves
Moderator
Planewalker
*****
Offline Offline

Gender: Male
Posts: 3195


« Reply #4 on: January 30, 2010, 09:50:50 AM »
Reply with quote

Another fun way to reproduce is to declare a component as BEGIN #123.

Fixed.
Logged

Please do not contact me for assistance in using BGT, BP, any other of the 'large mods', or a mod I didn't write or contribute to. I'm not your paid support staff, so I'd suggest you to direct your help questions to the forum relative to the mod you're playing.<br /><br />Thanks for your cooperation.
Pages: [1] Go Up Reply Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.1 | SMF © 2006, Simple Machines LLC Valid XHTML 1.0! Valid CSS!