Jump to content

Tigger script using llLinkedMessage & Chat Command


JackRipper666
 Share

You are about to reply to a thread that has been inactive for 4279 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hey guys! I'm puzzled again by some code I'm trying to modify. I'm basing my idea of how I wrote this off an animation script. So I'll probably look like a fool showing you this lol. Hopefully you can help me understand what I'm doing wrong if you get a chance.

I have this code here I found that I like below. What I want to do with it is just add a link_message to disable it's touch_start. I'll bring it back in a trigger script I like to name it. Since it will trigger it from there. But here is original code first. I highlighted the touch_start I have taken out below.

list MENU1 = [];
list MENU2 = [];
integer listener;
integer MENU_CHANNEL = 1000;
// opens menu channel and displays dialog
Dialog(key id, list menu)
{
llListenRemove(listener);
listener = llListen(MENU_CHANNEL, "", NULL_KEY, "");
llDialog(id, "Select one object below: ", menu, MENU_CHANNEL);
}
default
{
on_rez(integer num)
{
// reset scripts on rez
llResetScript();
}
touch_start(integer total_number)
{
integer i = 0;
MENU1 = [];
MENU2 = [];
// count the textures in the prim to see if we need pages
integer c = llGetInventoryNumber(INVENTORY_TEXTURE);
if (c <= 12)
{
for (; i < c; ++i)
MENU1 += llGetInventoryName(INVENTORY_TEXTURE, i);
}
else
{
for (; i < 11; ++i)
MENU1 += llGetInventoryName(INVENTORY_TEXTURE, i);
if(c > 22)
c = 22;
for (; i < c; ++i)
MENU2 += llGetInventoryName(INVENTORY_TEXTURE, i);
MENU1 += ">>";
MENU2 += "<<";
}
// display the dialog
Dialog(llDetectedKey(0), MENU1);
}
listen(integer channel, string name, key id, string message)
{
if (channel == MENU_CHANNEL)
{
llListenRemove(listener);
if (message == ">>")
{
Dialog(id, MENU2);
}
else if (message == "<<")
{
Dialog(id, MENU1);
}
else
{
// display the texture from menu selection
llSetTexture(message, ALL_SIDES);
}
}
}
}

 

-------------------------------------------------------------------------------------------------------------------------------

 

 

 

 

 Ok so now the modified version this time again. Highlighted where I put link_message.

 

 

--------------------------------------------------------------------------------------------------------------------------------------

list MENU1 = [];
list MENU2 = [];
integer listener;
integer MENU_CHANNEL = 0;
// opens menu channel and displays dialog
Dialog(key id, list menu)
{
llListenRemove(listener);
listener = llListen(MENU_CHANNEL, "", NULL_KEY, "");
llDialog(id, "Select one object below: ", menu, MENU_CHANNEL);
}
default
{
link_message(integer n, integer c, string m, key id){
integer i = 0;
MENU1 = [];
MENU2 = [];
// count the textures in the prim to see if we need pages
integer c = llGetInventoryNumber(INVENTORY_TEXTURE);
if (c <= 12)
{
for (; i < c; ++i)
MENU1 += llGetInventoryName(INVENTORY_TEXTURE, i);
}
else
{
for (; i < 11; ++i)
MENU1 += llGetInventoryName(INVENTORY_TEXTURE, i);
if(c > 22)
c = 22;
for (; i < c; ++i)
MENU2 += llGetInventoryName(INVENTORY_TEXTURE, i);
MENU1 += ">>";
MENU2 += "<<";
}
// display the dialog
Dialog(llDetectedKey(0), MENU1);
}
listen(integer channel, string name, key id, string message)
{
if (channel == MENU_CHANNEL)
{
llListenRemove(listener);
if (message == ">>")
{
Dialog(id, MENU2);
}
else if (message == "<<")
{
Dialog(id, MENU1);
}
else
{
// display the texture from menu selection
llSetTexture(message, ALL_SIDES);
}
}
}
}

 

----------------------------------------------------------------------------------------------------------------------------

 

 

 


An last but not least my my screwed up idea of a Trigger script that would start up the modified Dialog script that just grabs textures in a prim.

 

string ChatMsg = "Dialog"
integer Channel = 0: //listen chat channel
string Touch = "touch_start(integer total_number){"
default{
on_rez(integer r){
llResetScript();// Reset script and global variables to default state_entry.
}
state_entry(){
llMessageLinked(-1,-2,llDumpList2String([ChatMsg],"|"),"");// for link message
llListen(Channel,"","","");// Listen for chat messages.
}
touch_start(integer total_number){
listen(integer c, string n, key id, string m){
if(c == Channel){ // If correct channel
if(m == ChatMsg){ // If correct touch start
Touch = 1
}
}
}

 

Now if it makes any sense what I'm trying to do is have it talk to Dialog script. With the link message. I am really unsure if I can use touch_start this way or how else I could do it. But I'd appreciate any help on what maybe I could change to make it work lol.

Link to comment
Share on other sites

I just rushed over the myriads of code you posted (next time, use the little code folder sysmbol to keep it more readable) - but as far as I can see, the problem is the following line (at least, that's one thing)

Dialog(llDetectedKey(0), MENU1);

 link_message does not know llDetectKey. Pass the key from the touch event throug a parameter of llMessageLinked to the event as id and use id instead of llDetectedKey

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4279 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...