Jump to content


Dyara

Member Since 12 Jun 2002
Offline Last Active Jan 04 2004 10:34 PM

Topics I've Started

GLOBALs and LOCALS

02 March 2003 - 04:51 AM

I wonder if anyone has ever found a use for user defined tokens. Well, at least there´s one use. (In BG2:ToB?) you can use tokens to print the value of a variable:

IF
    True()
THEN
    RESPONSE #100
        SetTokenGlobal("DEBUGTEST","LOCALS","DEBUGTEST")
        DisplayString(Myself,"DEBUGTEST: <DEBUGTEST>")
        Continue()
END

IF
    True()
THEN
    RESPONSE #100
        IncrementGlobal("DEBUGTEST","LOCALS",1)
END

This script will display

DEBUGTEST: 0
DEBUGTEST: 1
DEBUGTEST: 2
...

in the message window. So instead of using a lot of CLUAConsole:GetGlobal(...) you can write a script that displays all your GLOBALs.

335 SetTokenGlobal(S:GLOBAL*,S:Area*,S:Token*)

also allows you to use the value of a variable in dialogue string.

edit: Looking at SimDing0´s scripting guide I´ve seen that it´s allready mentioned there. So it´s nothing really new but maybe there are a few who didn´t know.

WEIGHT #xy

09 February 2003 - 06:53 AM

I tried to write a dialogue with weights. The dialogue is assigned to a creature that says 'Test1' or 'Test2'. But if the global Test2 is set to 1 it should say 'Test3'. I thought that using a weight for state T3 I don´t have to change the state triggers T1 and T2:

BEGIN ~Test~

IF ~Global("TEST1","GLOBAL",0)~ THEN BEGIN T1
   SAY ~Test1~
   IF ~~ THEN EXIT
END

IF ~!Global("TEST1","GLOBAL",0)~ THEN BEGIN T2
   SAY ~Test2~
   IF ~~ THEN EXIT
END

IF WEIGHT #0 ~Global("TEST2","GLOBAL",1)~ THEN BEGIN T3
   SAY ~Test3~
   IF ~~ THEN EXIT
END

Unfortunately it seems not to work regardless of the weight (I´ve tried -999, -1, 0, 1 and many more).

Looking at the dlg file with InfExplorer, decompiling it with WeiDU again (or playing the dialogue with BG2) there are no weights:

BEGIN ~TEST~

IF ~Global("TEST1","GLOBAL",0)~ THEN BEGIN 0 // from:
  SAY #78411 /* ~Test1~ */
  IF ~~ THEN EXIT
END

IF ~!Global("TEST1","GLOBAL",0)~ THEN BEGIN 1 // from:
  SAY #78412 /* ~Test2~ */
  IF ~~ THEN EXIT
END

IF ~Global("TEST2","GLOBAL",1)~ THEN BEGIN 2 // from:
  SAY #78413 /* ~Test3~ */
  IF ~~ THEN EXIT
END

Of course I could write the dialogue without weights but using weights would make it much more simple.

Is it a bug in WeiDU,have I misunderstood the usage of weights or is there something wrong in my d file?

Bash door

31 January 2003 - 10:15 AM

Is it possible to check (inside a door script) if someone (unsuccessful) tries to bash a door? It´s allways unsuccessful because my door is locked.

I know you can check a failed picklock or a failed knock spell, but what about bashing a door?

Another question: Is is possible to check if someone only clicks on a door (to open it)? I tried Clicked(O:Object*) but it seems not to work.

WeiDU and the CDn subfolder

25 November 2002 - 05:39 AM

Searching in the WeiDU documentation I found


Version 76:
        * Also look in GAME/CDx/Data/ instead of just GAME/Data for BIFFs.


Does this mean that WeiDU doesn´t read the baldur.ini to find the CDn subfolders?

To explain: I (and perhaps many others) have more than one BG2 installation on the same harddrive and all these installations share the same CDn subfolders (just to save disk space).

Validate actions and triggers in *.d files

13 November 2002 - 09:25 AM

I´ve written a small command-line tool that validates all the actions and triggers in WeiDU *.d files. It can also write the names of variables or timers into a text file to find misspelled names or the using of wrong namespaces (GLOBAL instead of LOCALS and vice versa).

It´s here available for download.

There´s a large readme included. I hope it´s comprehensible, if not feel free to ask.