489
edits
Script 10k (talk | contribs) m (updated picture to link to wiki instead of external source) |
Script 10k (talk | contribs) (string comparison bug in TVs) |
||
Line 175: | Line 175: | ||
|} | |} | ||
===BSL bugs and workarounds=== | |||
====String comparison bug==== | |||
Trigger volumes can call bsl functions. This function can receive a string variable which contains the character name that triggered the trigger volume. | |||
Unfortunately seems there are a bug when comparing this string parameter with another string variable in the BSL. Even if the trigger volume string and the other string are equal when you compare them in BSL it always returns false. | |||
To reproduce the bug you can open "warehouse_level_scripts.bsl" in "EnvWarehouse" folder and replace the '''t65''' function by this one (make a backup of the file first): | |||
func void t65(string ai_name) | |||
{ | |||
var string testVar = "char_0"; | |||
dmsg(testVar); | |||
dmsg("char_0"); | |||
dmsg(ai_name); | |||
sleep(100); | |||
if(testVar eq "char_0"){ | |||
dmsg("regular string comparison works!"); | |||
} | |||
else{ | |||
dmsg("regular string comparison failed!"); | |||
} | |||
if(ai_name eq "char_0"){ | |||
dmsg("trigger volume string comparison worked!"); | |||
} | |||
else{ | |||
dmsg("trigger volume string comparison failed!"); | |||
} | |||
dprint t65 | |||
if(d6 eq 0) | |||
{ | |||
message xdoorislocked | |||
dprint door_is_locked | |||
} | |||
} | |||
Load savepoint 1 in chapter 1 and move the character until the door. This function will be triggered. What is the output that you expect? "trigger volume string comparison worked!" right? Wrong it will print "trigger volume string comparison failed!" even though both string variables have the same value. | |||
[[Image:Trigger_volume_string_comparison_bug.jpg|300px]] | |||
=====Possible workarounds===== | |||
If you need to detect few characters and if all of these are from different teams you can clone the trigger volume one time for each character and call different functions one for each team. This way you make sure you know which character triggered the trigger volume since each character has a unique team and a unique trigger volume function. | |||
===Mod Tool addon=== | ===Mod Tool addon=== |
edits