Author Topic: Bug in script compiler for actions with 3 or more string arguments  (Read 822 times)

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
IWD2's script action SpellCastEffect() is one of the few instances (or the only one?) that requires 3 string arguments:
Code: [Select]
289 SpellCastEffect(O:Source*,S:Voice*,S:Sound1*,S:Sound2*,I:Animation*sceffect,I:Speed*,I:Sequence*Sequence)
However, script bytecode only supports up to 2 separate string parameters. Additional arguments are added to the second string, separated by colon characters. WeiDU doesn't seem to add ':' characters, which results in a single merged string for the second string parameter.

Example:

Compiling
Code: [Select]
SpellCastEffect(Myself, "CAS_PP8M", "PRE_P02", "CAS_EN6", GLOW_ALTERATION, 1, ATTACK)

should generate the following bytecode:
Code: [Select]
AC
289OB
0 0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] "" 0 0 OB
OB
0 0 0 0 0 0 0 0 1 0 0 0 0 [-1.-1.-1.-1] "" 0 0 OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] "" 0 0 OB
10 0 0 1 0"CAS_PP8M" "PRE_P02:CAS_EN6" AC

WeiDU generates
Code: [Select]
AC
289OB
0 0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] "" 0 0 OB
OB
0 0 0 0 0 0 0 0 1 0 0 0 0 [-1.-1.-1.-1] "" 0 0 OB
OB
0 0 0 0 0 0 0 0 0 0 0 0 0 [-1.-1.-1.-1] "" 0 0 OB
10 0 0 1 0"CAS_PP8M" "PRE_P02CAS_EN6" AC

instead, which in turn decompiles into
Code: [Select]
SpellCastEffect(Myself, "CAS_PP8M", "PRE_P02CAS_EN6", "", GLOW_ALTERATION, 1, ATTACK)

Offline Wisp

  • Moderator
  • Planewalker
  • *****
  • Posts: 1176
Re: Bug in script compiler for actions with 3 or more string arguments
« Reply #1 on: August 04, 2015, 04:22:13 PM »
I'll have a look.

Offline Argent77

  • Planewalker
  • *****
  • Posts: 187
Re: Bug in script compiler for actions with 3 or more string arguments
« Reply #2 on: August 05, 2015, 06:26:46 AM »
Update:
Namespace strings (such as used in "S:Area*", "S:Area1*", "S:Area2*") still have to be processed in the usual way.

I have found one more trigger and two more actions in IWD2, which are using three or more non-namespace strings parameters. I haven't seen them used in scripts yet, however.

Triggers:
0x40A6 GlobalBitGlobal(S:String1*,S:String2*,S:String3*,S:String4*,I:Mode*BitMode)

Actions:
243 IncrementGlobalOnce(S:String1*,S:String2*,S:String3*,S:String4*,I:Value*)
and
248 GlobalBitGlobal(S:String1*,S:String2*,S:String3*,S:String4*,I:Mode*BitMode)
again (not sure if this is a bug in the game or a valid action)

 

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)?: