I have a script that reads data from two notecards and uses one to configure two lists which become menu dialog boxes. all variables are set with integer/string/list commands etc. And the dialogue handling code is missing off the end as it is not related to my problem as you will see.
---
At the moment the script is about 90% there, bar the fact that once the script goes all the way to the end, it exits and does not loop round to allow the prim it lives in to be clicked on again.
I think it is due to the touch_event not being in the main program state so it has no way to re-access that event.
Below main part of the script show how the two sections interlink... Now this works fine. No errors, problems or anything (bar not allow a user to click again).
CODE
default
{
state_entry()
{
llSay(0, "TSWTS Test");
CardName1 = llGetInventoryName(INVENTORY_NOTECARD, 0);
CardDataRead1 = llGetNotecardLine(CardName1, CardLine1);
CardName2 = llGetInventoryName(INVENTORY_NOTECARD, 1);
CardDataRead2 = llGetNotecardLine(CardName2, CardLine2);
}
dataserver (key Data_id, string CardData) {
if (Data_id == CardDataRead1) {
if (CardData !=EOF) {
AllowList = AllowList + CardData;
++CardLine1;
CardDataRead1 = llGetNotecardLine(CardName1, CardLine1);
}
}
else if (Data_id == CardDataRead2) {
if (CardData !=EOF) {
MenuList = MenuList + CardData;
++CardLine2;
CardDataRead2 = llGetNotecardLine(CardName2, CardLine2);
}
}
}
touch_start(integer total_number)
{
toucher = llDetectedKey(0);
state mainmenu;
}
}
state mainmenu
{
state_entry()
{
llSay(0, "Mainmenu");
MenuMain1 = MenuMain1+llList2String(MenuList, 0)+llList2String(MenuList, 1)+llList2String(MenuList, 2);
MenuMain2 = MenuMain2+llList2String(MenuList, 3)+llList2String(MenuList, 4)+llList2String(MenuList, 5);
llListen(Channel, "", NULL_KEY, ""); // listen for dialog answers (from multiple users)
llDialog(toucher, "What do you want to do?", MenuMain1, Channel); // present dialog on click
toucher = NULL_KEY;
}
/CODE
Okay... I thought about how to alter this and came up with the code below. Now to me should work. BUT there is a problem which I do not understand.
Let me show you the code first:CODE
default
{
state_entry()
{
llSay(0, "TSWTS Tes");
CardName1 = llGetInventoryName(INVENTORY_NOTECARD, 0);
CardDataRead1 = llGetNotecardLine(CardName1, CardLine1);
CardName2 = llGetInventoryName(INVENTORY_NOTECARD, 1);
CardDataRead2 = llGetNotecardLine(CardName2, CardLine2);
}
dataserver (key Data_id, string CardData) {
if (Data_id == CardDataRead1) {
if (CardData !=EOF) {
AllowList = AllowList + CardData;
++CardLine1;
CardDataRead1 = llGetNotecardLine(CardName1, CardLine1);
}
}
else if (Data_id == CardDataRead2) {
if (CardData !=EOF) {
MenuList = MenuList + CardData;
++CardLine2;
CardDataRead2 = llGetNotecardLine(CardName2, CardLine2);
}
}
state mainmenu;
}
}
state mainmenu
{
state_entry()
{
llSay(0, "Mainmenu");
if (menuset == FALSE)
{
llSay(0, "False");
MenuMain1 = MenuMain1+llList2String(MenuList, 0)+llList2String(MenuList, 1)+llList2String(MenuList, 2);
MenuMain2 = MenuMain2+llList2String(MenuList, 3)+llList2String(MenuList, 4)+llList2String(MenuList, 5);
menuset = TRUE;
}
}
touch_start(integer total_number)
{
toucher = llDetectedKey(0);
llListen(Channel, "", NULL_KEY, ""); // listen for dialog answers (from multiple users)
llDialog(toucher, "What do you want to do?", MenuMain1, Channel); // present dialog on click
}
When I run this version, the menu lists are NOT created. I know the routine to make them is accessed, as I put a test llSay command in there to prove it. but get a script error when run and you click on the prim saying: Object: llDialog: all buttons must have label strings
I am totaly confused. Why are the menus created in the first one but not in the second? The commands are identical, they are just accessed in a slightly different place within the script but I did not thing that would make any difference to be honest.
I hope that waffling makes some sense.. I cannot explain it correctly as my English lets me down being a second language to me.
Any help is appreicate.
I will go and try that in a moment.