Author Topic: Strings in actions launched from .d  (Read 1217 times)

zefklop

  • Guest
Strings in actions launched from .d
« on: August 05, 2009, 02:26:39 PM »
Hi everybody!

As a code sample is sometimes more explicit...

Code: [Select]
IF ~NumTimesTalkedTo(0)~ THEN BEGIN RunTest
   SAY ~"Cutscene test will begin now, please wait, it will length approximately 5 seconds"~
   IF ~~ THEN DO ~ActionOverride("tester2",AttackNoSound("tester1"))
                 Wait(5)
                 SetGlobal("TestCutsceneRunning", "GLOBAL", 1)
                 DisplayString(Myself, "StartCutSceneMode being called")
                 StartCutSceneMode()
                 Wait(5)
                 DisplayString(Myself, "StartCutScene Being called")
                 StartCutScene("cuttest")~ EXIT
END

This one will compile with warnings, and the DiplayString action will display the strref #0
Enclosing the string with ~ will lead to a sparse error.

I don't know if this is feasible, but it would be nice to have this done correctly (meaning, adding a new strref and use it, as weidu does it usually)

As a workaround, if someone could tell me if this is possible to add a new strref from tp2 and stores its number in a variable, this would work too. (and yes, I know that I should use weidu more often)

Offline cmorgan

  • Planewalker
  • *****
  • Posts: 1424
  • Gender: Male
  • Searcher of Bugs
Re: Strings in actions launched from .d
« Reply #1 on: August 05, 2009, 02:44:14 PM »
Try a simplification that does not have as much chance of confusing WeiDU with all those nested string delimiters, something like
Code: [Select]
IF ~Global("starttest", "GLOBAL", 0)~ THEN BEGIN RunTest
   SAY ~Would you like to repeat the test?~
  IF ~~ THEN REPLY  ~Yes, I would. Cutscene test will begin now, please wait, length approximately 5 seconds~ DO ~ClearAllActions()
                 Wait(5)
                 SetGlobal("TestCutsceneRunning", "GLOBAL", 1)
                 DisplayString(Myself,~StartCutSceneMode being called~)
                 StartCutSceneMode()
                 Wait(5)
                 DisplayString(Myself,~StartCutScene Being called~)
                 StartCutScene("cuttest")~ EXIT
  IF ~~ THEN REPLY  ~No thank you. I do not wat to test any more. Set the global to 1 so I do not have it popping up all the time, please.~ DO ~SetGlobal("starttest", "GLOBAL", 1)~ EXIT
END

with the relevant cutscene cuttest

Code: [Select]
CutSceneID(Player1)
SetGlobal("TestCutsceneRunning", "GLOBAL", 0)
DisplayStringHead(Player1, ~Test global cleared so we can repeat the test~)
EndCutSceneMode()
StartDialogNoSet(Player1)

and see if that works -

zefklop

  • Guest
Re: Strings in actions launched from .d
« Reply #2 on: August 05, 2009, 03:00:39 PM »
The problem is still there: weidu refuses to consider second argument of DisplayString as a string and fails with a sparsing error.


Offline devSin

  • Planewalker
  • *****
  • Posts: 1632
  • Gender: Male
Re: Strings in actions launched from .d
« Reply #3 on: August 05, 2009, 05:38:09 PM »
Use %s to enclose your TRA strings in .D actions. Or use TRA refs.
« Last Edit: August 05, 2009, 05:42:19 PM by devSin »

zefklop

  • Guest
Re: Strings in actions launched from .d
« Reply #4 on: August 09, 2009, 04:48:35 PM »
Thanks, I finally used tra files. Still, I was very surprised this did not work, and my work is really not intended to be translated.

Offline plainab

  • Sasha al'Therin
  • Planewalker
  • *****
  • Posts: 491
    • Infinity Engine Modding
Re: Strings in actions launched from .d
« Reply #5 on: August 09, 2009, 06:24:07 PM »
I had something similar with an inlined script that was being extended to the bottom of a pre-existing script.

I solved it by using OUTER_SPRINT to define a variable and then putting that variable inside %'s inside ~'s and a EVALUATE_BUFFER after the EXTEND_BOTTOM line. It worked like a charm.

In your case, if you didn't want to mess with a tra file, you could try the following...

Code: [Select]
OUTER_SPRINT cut_text ~StartCutSceneMode being called~
COMPILE ~some.d~ //where your dialog file has ~%cut_text%~ instead of ~StartCutSceneMode being called~
 EVALUATE_BUFFER

Then again, .baf and .d can be handled differently by weidu so who knows for sure....

But it doesn't matter how you get it to work, so long as you get it to work. Of which it sounds like you already got something to work...

My working mods:
an AI Party Script for BG2 game engine DOWNLOAD LINK ONLY!
Interactive Tweaks for BG series with some IWD support. DOWNLOAD LINK ONLY!
Rest For 8 Hours an IWD mod
-------------------------------------------
My contributions: BG1Fixpack, BG1Tweaks
On Hold: Solestia an NPC for SOA
-------------------------------------------
My website: http://sasha-altherin.webs.com

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: