This script goes into the rezzer prim:
CODE
default
{
touch_start(integer total_number)
{
string tkey = (string)llGetOwner();
integer conv = (integer)("0x" + llGetSubString(tkey, 9, 12)); //convert second key section(after 1st dash) to a hex value.
llRezObject("Sphere", llGetPos() + <0, 0, 1>, ZERO_VECTOR, ZERO_ROTATION, conv);
}
}
This one goes into the prim that's to be rezzed:
CODE
string charset = "0123456789abcdef";
string int2chr(integer int) { // convert integer to unsigned charset
integer base = llStringLength(charset);
string out;
integer j;
if(int < 0) {
j = ((0x7FFFFFFF & int) % base) - (0x80000000 % base);
integer k = j % base;
int = (j / base) + ((0x7FFFFFFF & int) / base) - (0x80000000 / base);
out = llGetSubString(charset, k, k);
}
do
out = llGetSubString(charset, j = int % base, j) + out;
while(int /= base);
return out;
}
default
{
on_rez(integer param)
{
string keypart = int2chr(param);
llOwnerSay(keypart);
}
}
I tested it and it and the child prim did indeed return the same part of my key as was fed to the rezzer prim to begin with.
So for all of you who have been searching for a way to pass a key through the on_rez parameter so as to avoid listen lag, here's your solution. You can't pass a whole key, since the integer is a 32-bit field and a key is 128-bit. But this script passes down 4 characters which you can then compare in the script of the rezzed prim through llSubStringIndex().
There is an incredibly small chance that there will be 2 avatars/objects within sensor range who have the same key part after the same dash. So that worry should be safely ignored. But then, 4 hex digits only take 16 bits. So if you're really worried about it, you could pass up to 8 digits of the key to minimize this chance to practically non-existance.
Credit where credit is due: I pulled the conversion function off the wiki at: http://lslwiki.net/lslwiki/wakka.php?wakka=ExampleNumberConversion
The same seems to be doable with short strings if using the opposite function also listed on that wiki page in order to convert a string to an integer value. It only works with up to 6 characters though. It could still be used to pass on short text commands to the rezzed object.
Hope this helps.