Jump to content

Question to using OUTER_SPRINTs in the tp2


jastey

Recommended Posts

 I need a second pair of eyes. I define this in the ALWAYS section:

ACTION_IF GAME_IS ~bgee~ THEN BEGIN
  OUTER_SPRINT ~eet_2~ ~~
END
ACTION_IF GAME_IS ~eet~ THEN BEGIN
  OUTER_SPRINT ~eet_2~ ~2~
END

But it throws an error at all instances where I'm using %eet_2% in the tp2:

instance 1:

ADD_JOURNAL EXISTING TITLE (#%eet_2%59615) @10000 @10001 @10002 @10003 @10004 @10005 @10006 @10007 @10008 @10009 @10010 @10011 @10012 @10013 @10014 @10015 @10016 @10017 @10018 @10019 @10020 @10021 @10022 @10023 @10024 @10025 @10026 @10027 @10028 @10029 @10030 @10031 USING ~sodrtd/translations/autotra/%LANGUAGE%/game.tra~

instance 2:

COPY_EXISTING ~sodrtd/cre/c#rtdblc.cre~ ~override/c#rtdblc.cre~
SAY NAME1 ~Karlen~
SAY NAME2 ~Karlen~
SAY SELECT_COMMON1 #%eet_2%69456

Wrapping it in ~~ makes it writing a string, not a number. Adding EVAL gave an error, too. Using OUTER_SET instead gave an error.

Using this inside a d-file works like a charm. I know I am missing something obvious. Any hints welcome.

Link to comment

Variable replacement cannot be performed for instances where WeiDU expects a numeric value or an expression.

There are several ways around it though. For SAY you can use WRITE_LONG instead. The ADD_JOURNAL action is more limited, but it's possible to include variable replacements if you build the command dynamically and INCLUDE it.

Btw, simply prefixing existing strrefs by "2" can be dangerous if the strref in question is either less than 10000, or greater than 100000. It's much safer to add 200000 as a number instead.

ALWAYS
  OUTER_SET eet_2 = GAME_IS ~eet~ ? 200000 : 0
END

// Build ADD_JOURNAL command dynamically
<<<<<<<< .../inlined/my_mod/journal.tph
>>>>>>>>
OUTER_SET title_strref = eet_2 + 59615
APPEND_OUTER - ~.../inlined/my_mod/journal.tph~ "ADD_JOURNAL EXISTING TITLE (#%title_strref%) @10000 @10001 @10002 @10003 @10004 @10005 @10006 @10007 @10008 @10009 @10010 @10011 @10012 @10013 @10014 @10015 @10016 @10017 @10018 @10019 @10020 @10021 @10022 @10023 @10024 @10025 @10026 @10027 @10028 @10029 @10030 @10031 USING ~sodrtd/translations/autotra/%LANGUAGE%/game.tra~"
INCLUDE ~.../inlined/my_mod/journal.tph~

// Replace SAY by WRITE_LONG
COPY_EXISTING ~sodrtd/cre/c#rtdblc.cre~ ~override/c#rtdblc.cre~
  SAY NAME1 ~Karlen~
  SAY NAME2 ~Karlen~
  WRITE_LONG SELECT_COMMON1 (eet_2 + 69456)

 

Link to comment

@argent77 thank you very much for the answer with examples.

I am using the OUTER_SPRINT inside of d-files and it seems to work. Am I outsmarting WeiDU there?

EDIT: I already got a very good explanation from @Taimon for why it works inside a d-file. Thanks!

At least this inside a d-file:

== BDCAELAR #%eet_2%39143 /* How many have scorned me these past months? How many believed it mad to open the portal to Avernus? I could not ask. I could not risk your refusal. */

 

looks right if compiled/decompiled:

IF ~~ THEN BEGIN 100 // from: 99.0
SAY #39143 /* ~How many have scorned me these past months? How many believed it mad to open the portal to Avernus? I could not ask. I could not risk your refusal.~ */
IF ~~ THEN GOTO 101
END

 

...My next question would be how to work with OUTER_SET inside a d-file (if necessary)...

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...