Dialogs in SL require lists of strings to generate their buttons. However, a key from the link_message event, typecast to string and added as a button, generates the wrong type error. Event when saving the typecast key to a string variable first.
The code below is an example of this error:
CODE
default
{
state_entry()
{
llMessageLinked(LINK_SET, 0, "", "test");
}
link_message(integer sender_num, integer num, string str, key id)
{
list buttons = [(string)id];
llDialog(llGetOwner(), "Test Message", buttons, 0);
}
}
This ofcourse annoyed me no end, as I tried all matter of things to get it working. In the end, I found a simple workaround (however, would ofcourse be best to avoid where possible as it needlessly adds to the script (ie, the bug needs fixing)).
CODE
default
{
state_entry()
{
llMessageLinked(LINK_SET, 0, "", "test");
}
link_message(integer sender_num, integer num, string str, key id)
{
list buttons = llList2String([id], 0);
llDialog(llGetOwner(), "Test Message", buttons, 0);
}
}
I'm sure this is just a random, stray bug, that not many people are gonna come across, but thats the fix should people want it. Instead of typecasting the key to a string, use llList2String to get the result. Also, just to point out, I've only come across this with the key passed through the link_message event, other keys seem to work absolutely fine with it.