the notecard is one line with a number that I want to set the Listen channel to.
CODE
17
This is the script:
CODE
integer channel; // not assigning this variable set it to 0
string gName = "New Note"; // notecard line 1 is 17, so we should be listening to channel 12
integer gLine = 0; // current line number
key gQueryID; // id used to identify dataserver queries
default
{
state_entry()
{
gQueryID = llGetNotecardLine(gName, gLine); // request first line
llListen(channel, "", NULL_KEY, "");
llSay(0, "state_entry channel set to " + (string)channel);
}
listen(integer channel, string name, key id, string message)
{
llSay(0, "Button Pushed");
}
dataserver(key query_id, string data)
{
if (query_id == gQueryID)
{
if (data != EOF) // not at the end of the notecard
{
channel = (integer)data;
llSay(0, "Channel should be set to " + data);
llSay(0, "Now the script is listening to channel " + (string)channel);
}
}
}
touch_start(integer num)
{
llDialog(llDetectedKey(0), "test script", ["test"], channel);
}
}
The output from the script on reset is:
CODE
Object: state_entry channel set to 0
Object: Channel should be set to 17
Object: Now the script is listening to channel 17
and touching the menu button yields no result
But, if I edit the line in the notecard to be "0",
the script runs correctly:
CODE
which is correct.
Object: state_entry channel set to 0
Object: Channel should be set to 0
Object: Now the script is listening to channel 0
You: test
Object: Button Pushed
Can someone point me in the right direction, so that I can set the listen channel from a notecard?
Thanks,
Sam
