Pocket Plane Group Logo PPG Modlist Logo
Welcome, Guest. Please login or register.
September 02, 2010, 04:20:18 PM

Login with username, password and session length
Search:     Advanced search
Quest Pack released! Download from http://www.pocketplane.net/quest!
132813 Posts in 13492 Topics by 3972 Members
Latest Member: nikjensen
* 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 501 times)
Miloch
Barbarian
Planewalker
*****
Offline Offline

Gender: Male
Posts: 667



« 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: 667



« 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: 3370


« 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

Author or Co-Author: WeiDU - Widescreen - Generalized Biffing - Refinements - TB#Tweaks - IWD2Tweaks - Some mods that I won't mention in public
Soundset and portrait packs: Alyx Vance (from Half-Life 2) - Jane "The Soldier" Doe (from Team Fortress 2)
Maintainer: Semi-Multi Clerics - Nalia Mod - Nvidia Fix
Contributions: See the PPG Modlist  Smiley
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!