From: Jesse Barnett
Try looking in this thread. It shows an example of rezzing using listens and another using object_rex:
/54/80/220084/1.htmlIf that doesn't help then post your code here and we can more clearly help straighten it out.
I nearly replied that I couldn't understand it until I realised it stretched onto a second page. Thanks for that but it doesn't work in my situation.
Standby for scripts
Oh I wish those Lindens would fix whatever it is that stops them allowing BBCodes.
Consider a multi prim object one of whom has the following two scripts in it.
ObjRez
// Global Constants
integer CHANNEL4321 = 4321; // Prefix receiving channel
// Global Variables
integer Prefix; // Prefix for llwhisper commands
integer CHANNEL1001; // INPUT Rezzing channel
integer CHANNEL2206; // OUTPUT Setup restart channel
integer CHANNEL2209; // OUTPUT Play continue channel
string ColPiece; // Color of piece to be rezzed
vector Pos; // Position of rezzing object
list PC2_61; // Position of pieces 2 - 61
list PC62_122; // Position of pieces 62 - 122
// Functions
Init2_61()
{
PC2_61 =
[< 1.11000, 0.00000,0.390>,< 0.97125,-0.08057,0.390>,< 0.97125, 0.08057,0.390>, // 002-004
< 0.83250,-0.16114,0.390>,< 0.83250, 0.00000,0.390>,< 0.83250, 0.16114,0.390>, // 005-007
< 0.69375,-0.24171,0.390>,< 0.69375,-0.08057,0.390>,< 0.69375, 0.08057,0.390>, // 008-010
< 0.69375, 0.24171,0.390>,< 0.55500,-0.96686,0.390>,< 0.41625,-0.88629,0.390>, // 009-013
< 0.55500,-0.80571,0.390>,< 0.27750,-0.80571,0.390>,< 0.41625,-0.72514,0.390>, // 014-016
< 0.55500,-0.64457,0.390>,< 0.13875,-0.72514,0.390>,< 0.27750,-0.64457,0.390>, // 017-019
< 0.41625,-0.56400,0.390>,< 0.55500,-0.48343,0.390>,<-0.55500,-0.96686,0.390>, // 020-022
<-0.55500,-0.80571,0.390>,<-0.41625,-0.88629,0.390>,<-0.55500,-0.64457,0.390>, // 023-025
<-0.41625,-0.72514,0.390>,<-0.27750,-0.80571,0.390>,<-0.55500,-0.48343,0.390>, // 026-028
<-0.41625,-0.56400,0.390>,<-0.27750,-0.64457,0.390>,<-0.13875,-0.72514,0.390>, // 029-031
<-1.11000, 0.00000,0.390>,<-0.97125, 0.08057,0.390>,<-0.97125,-0.08057,0.390>, // 032-034
<-0.83250, 0.16114,0.390>,<-0.83250, 0.00000,0.390>,<-0.83250,-0.16114,0.390>, // 035-037
<-0.69375, 0.24171,0.390>,<-0.69375, 0.08057,0.390>,<-0.69375,-0.08057,0.390>, // 038-040
<-0.69375,-0.24171,0.390>,<-0.55500, 0.96686,0.390>,<-0.41625, 0.88629,0.390>, // 041-043
<-0.55500, 0.80571,0.390>,<-0.27750, 0.80571,0.390>,<-0.41625, 0.72514,0.390>, // 044-046
<-0.55500, 0.64457,0.390>,<-0.13875, 0.72514,0.390>,<-0.27750, 0.64457,0.390>, // 047-049
<-0.41625, 0.56400,0.390>,<-0.55500, 0.48343,0.390>,< 0.55500, 0.96686,0.390>, // 050-052
< 0.55500, 0.80571,0.390>,< 0.41625, 0.88629,0.390>,< 0.55500, 0.64457,0.390>, // 053-055
< 0.41625, 0.72514,0.390>,< 0.27750, 0.80571,0.390>,< 0.55500, 0.48343,0.390>, // 056-058
< 0.41625, 0.56400,0.390>,< 0.27750, 0.64457,0.390>,< 0.13875, 0.72514,0.390> // 059-061
];
} // end of Init2_61 block
Init62_122()
{
PC62_122 =
[< 0.55500,-0.32229,0.390>,< 0.55500,-0.16114,0.390>,< 0.55500, 0.00000,0.390>, // 062-064
< 0.55500, 0.16114,0.390>,< 0.55500, 0.32229,0.390>,< 0.41625, 0.40286,0.390>, // 065-067
< 0.27750, 0.48343,0.390>,< 0.13875, 0.56400,0.390>,< 0.00000, 0.64457,0.390>, // 068-070
<-0.13875, 0.56400,0.390>,<-0.27750, 0.48343,0.390>,<-0.41625, 0.40286,0.390>, // 071-073
<-0.55500, 0.32229,0.390>,<-0.55500, 0.16114,0.390>,<-0.55500, 0.00000,0.390>, // 074-076
<-0.55500,-0.16114,0.390>,<-0.55500,-0.32229,0.390>,<-0.41625,-0.40286,0.390>, // 077-079
<-0.27750,-0.48343,0.390>,<-0.13875,-0.56400,0.390>,< 0.00000,-0.64457,0.390>, // 080-082
< 0.13875,-0.56400,0.390>,< 0.27750,-0.48343,0.390>,< 0.41625,-0.40286,0.390>, // 083-085
< 0.41625,-0.24171,0.390>,< 0.41625,-0.08057,0.390>,< 0.41625, 0.08057,0.390>, // 086-088
< 0.41625, 0.24171,0.390>,< 0.27750, 0.32229,0.390>,< 0.13875, 0.40286,0.390>, // 089-091
< 0.00000, 0.48343,0.390>,<-0.13875, 0.40286,0.390>,<-0.27750, 0.32229,0.390>, // 092-094
<-0.41625, 0.24171,0.390>,<-0.41625, 0.08057,0.390>,<-0.41625,-0.08057,0.390>, // 095-097
<-0.41625,-0.24171,0.390>,<-0.27750,-0.32229,0.390>,<-0.13875,-0.40286,0.390>, // 098-100
< 0.00000,-0.48343,0.390>,< 0.13875,-0.40286,0.390>,< 0.27750,-0.32229,0.390>, // 101-103
< 0.27750,-0.16114,0.390>,< 0.27750, 0.00000,0.390>,< 0.27750, 0.16114,0.390>, // 104-106
< 0.13875, 0.24171,0.390>,< 0.00000, 0.32229,0.390>,<-0.13875, 0.24171,0.390>, // 107-109
<-0.27750, 0.16114,0.390>,<-0.27750, 0.00000,0.390>,<-0.27750,-0.16114,0.390>, // 110-112
<-0.13875,-0.24171,0.390>,< 0.00000,-0.32229,0.390>,< 0.13875,-0.24171,0.390>, // 113-115
< 0.13875,-0.08057,0.390>,< 0.13875, 0.08057,0.390>,< 0.00000, 0.16114,0.390>, // 116-118
<-0.13875, 0.08057,0.390>,<-0.13875,-0.08057,0.390>,< 0.00000,-0.16114,0.390>, // 119-121
< 0.00000, 0.00000,0.390> // 122
];
} // end of Init62_122 block
Init()
{
CHANNEL1001 = Prefix + 1001;
CHANNEL2206 = Prefix + 2206;
CHANNEL2209 = Prefix + 2209;
llListen(CHANNEL4321,"",NULL_KEY,"");
llListen(CHANNEL1001,"",NULL_KEY,"");
} // end of Init block
// States
default
{
state_entry()
{
Pos = llGetPos();
Init2_61();
Init62_122();
Init();
} // end of state_entry block
on_rez(integer start_param)
{
Pos = llGetPos();
Init2_61();
Init62_122();
Init();
} // end of on_rez block
touch_start(integer total_number)
{
// llOwnerSay("Touched!");
} // end of touch_start block
listen(integer channel, string name, key id, string message)
{
if(channel == CHANNEL1001)
{
if(llGetSubString(message,0,2) == "Add")
{
if(llGetSubString(message,6,8) == "Red")
{
ColPiece = "RedPiece";
}else
if(llGetSubString(message,6,8) == "Yel")
{
ColPiece = "YelPiece";
}else
if(llGetSubString(message,6,8) == "Grn")
{
ColPiece = "GrnPiece";
}else
if(llGetSubString(message,6,8) == "Cyn")
{
ColPiece = "CynPiece";
}else
if(llGetSubString(message,6,8) == "Blu")
{
ColPiece = "BluPiece";
}else
if(llGetSubString(message,6,8) == "Mag")
{
ColPiece = "MagPiece";
}else ColPiece = "Piece";
Pos = llGetPos();
integer itemp = (integer)llGetSubString(message,3,5);
if (itemp >= 2 && itemp <= 61)
{
vector vtemp = llList2Vector(PC2_61,itemp - 2);
llRezObject(ColPiece,(Pos + vtemp),ZERO_VECTOR,ZERO_ROTATION,Prefix + 3000 + itemp);
llSetScriptState(llGetScriptName(),FALSE);
llWhisper(CHANNEL2206,"Restart");
llWhisper(CHANNEL2209,"Continue");
}else // end of 2 - 61 block
if (itemp >= 62 && itemp <= 122)
{
vector vtemp = llList2Vector(PC62_122,itemp - 62);
llRezObject(ColPiece,(Pos + vtemp),ZERO_VECTOR,ZERO_ROTATION,Prefix + 3000 + itemp);
llSetScriptState(llGetScriptName(),FALSE);
llWhisper(CHANNEL2206,"Restart");
llWhisper(CHANNEL2209,"Continue");
}else // end of 62 - 122 block
{
llSay(0,"SERIOUS ERROR report this message to Gregory McLeod");
llSay(0,(string)Prefix + "Add number less than 2 or greater than 122");
llSay(0,"Script stopping until corrected!!!!");
llSetScriptState(llGetScriptName(),FALSE);
}
} // end of Add blocks
}else // end of CHANNEL1001 block
if (channel == CHANNEL4321)
{
if (llGetSubString(message,0,5) == "Prefix")
{
llOwnerSay("ObjRez.Prefix: " + (string)Prefix);
}
}
} // end of listen event handler
link_message(integer sender_number,integer number,string message,key ID)
{
if(sender_number == LINK_ROOT && message == "PfxLod")
{
Prefix = number;
Init();
}
}
} // end of default state
[\code]
RezRcv
// Global constants
// Global variables
// Functions
// States
default
{
state_entry()
{
}
object_rez(key id)
{
llSleep(0.4);
llSetScriptState("ObjRez",TRUE);
}
}
[\code]
The pieces referred to in the ObjRez script are contained within the prim that contains ObjRez and rezRcv and contain the following code.
// Global Constants
integer CHANNEL6543 = 6543;
// Global Variables
integer Prefix; // default prefix
integer CHANNEL2109; // OUTPUT Notify channel
integer CHANNEL2209; // Notify channel for script state start
integer CHANNEL3XXX; // INPUT channel
integer Loc_start_param; // Local copy of start_param
integer Flashing; // Control for flashing
string Status; // Status: Col, Dim, Fls or Mpt
// Functions
Init()
{
CHANNEL2109 = Prefix + 2109;
CHANNEL2209 = Prefix + 2209;
} // end of Init
string LPADS(string src)
{
return llGetSubString("000" + src, -3, -1);
}
// States
default
{
state_entry()
{
llListen(CHANNEL6543,"",NULL_KEY,"");
} // end of state_entry handler
on_rez(integer start_param)
{
Loc_start_param = start_param % 10000;
Prefix = start_param - Loc_start_param;
Init();
CHANNEL3XXX = start_param;
llListen(CHANNEL3XXX,"",NULL_KEY,"");
} // end of on_rez event handler
touch_start(integer total_number)
{
llWhisper(CHANNEL2109,"Tch" + LPADS((string)(CHANNEL3XXX - Prefix - 3000)) + (string)llDetectedKey(0));
} // end of touch_start event handler
listen(integer channel, string name, key id, string message)
{
if (channel == CHANNEL3XXX && message == "Dim")
{
Status = "Dim";
llSetAlpha(0.5,ALL_SIDES);
llSetTimerEvent(0.0);
llWhisper(CHANNEL2209,"Continue");
}else // end of DIMmed block
if (channel == CHANNEL3XXX && message == "Fls")
{
Status = "Fls";
llSetTimerEvent(0.5);
llWhisper(CHANNEL2209,"Continue");
}else // end of FLaShing block
if (channel == CHANNEL3XXX && message == "Col")
{
llSetAlpha(1.0,ALL_SIDES);
Status = "Col";
llWhisper(CHANNEL2209,"Continue");
llSetTimerEvent(0.0);
}else // end of COLored block
if (channel == CHANNEL3XXX && message == "Mpt")
{
llWhisper(CHANNEL2209,"Continue");
llDie();
}else // end of eMPTy block
if (channel == CHANNEL6543 && message == "Prefix")
{
llOwnerSay((string)CHANNEL3XXX + ".Prefix: " + (string)Prefix);
} // end of CHANNEL6543 block
} // end of Listen event handler
timer()
{
if (Flashing == 0)
{
llSetAlpha(0.0,ALL_SIDES);
Flashing = 1;
}else
{
llSetAlpha(1.0,ALL_SIDES);
Flashing = 0;
}
} // end of timer event handler
} // end of default state
[\code]
The problem re-stated is that on odd occasions the ObjRez script never gets restarted by the RezRcv script. I am not sure what happens. It is very difficult to repeat the user's actions and timing while debugging so it is not yet clear whether the object_rez is getting lost or being received and not acted upon or what.
Any time I use the object my input never causes the failure and I am resorting to trying to capture what input's the users have made to deterine the cause.
Any help appreciated.