Jump to content
OtisTDog

Usage Hints for DisplayString()?

Recommended Posts

Hello, all --

 

I finished my first dialog and am working on my first script. It's actually doing what I want it to, thanks to all of the great info on IEDSP and these forums.

 

I have a question about the use of the DisplayString() action in the context of BG:TotSC scripting. It appears you have to provide a specific StrRef value in the call, which is fine if you want to make use of an existing string -- but how do you insert your own string?

 

It does not appear that I can just insert the string I want and have it automatically compiled by WeiDU, as will work with dialog changes. It seems as though I have to somehow get the string built in, then ID the number of that string, then provide that number to the call.

 

Any hints on how the pros handle this? My only ideas so far seem pretty kludgey, and like they would probably break if I make further changes and recompile (which might change the strref for the target string).

 

--Otis

Share this post


Link to post
Hello, all --

 

I finished my first dialog and am working on my first script. It's actually doing what I want it to, thanks to all of the great info on IEDSP and these forums.

 

I have a question about the use of the DisplayString() action in the context of BG:TotSC scripting. It appears you have to provide a specific StrRef value in the call, which is fine if you want to make use of an existing string -- but how do you insert your own string?

 

It does not appear that I can just insert the string I want and have it automatically compiled by WeiDU, as will work with dialog changes. It seems as though I have to somehow get the string built in, then ID the number of that string, then provide that number to the call.

 

Any hints on how the pros handle this? My only ideas so far seem pretty kludgey, and like they would probably break if I make further changes and recompile (which might change the strref for the target string).

 

--Otis

You need to provide a .tra file for your script, and code it like thus:

IF
 Entered([ANYONE])
 GlobalLT("BHGnollQuest","GLOBAL",2)
THEN
 RESPONSE #100
DisplayString(Myself,@300)
SetGlobal("BHGnollQuest","GLOBAL",2)
END

Share this post


Link to post
You need to provide a .tra file for your script

 

Ah. I haven't looked at that stuff at all since I thought it was just for translations. I'll check it out -- thanks!

 

--Otis

Share this post


Link to post

You can also use REPLACE, like this:

 

// BAF File
IF
 True()
THEN
RESPONSE #100
 DisplayString(100000000)
END

in conjunction with:

// TP2 File
//rest of your mod
COMPILE ~myMod/myBaf.baf~
REPLACE ~100000000~ ~newString~ //and it should update the strings, replacing your nonsensical number with the one you want :)

 

Icen

Edited by Icendoan

Share this post


Link to post

You can use DisplayString(Myself,~String~). REPLACE is not necessary.

Share this post


Link to post
You can use DisplayString(Myself,~String~). REPLACE is not necessary.

 

Hey, great! I had tried this originally, but I got a compile error. Must have been some other issue causing the error, because this approach is working fine now.

 

Thanks very much!

 

--Otis

Share this post


Link to post
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...