Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llRezObject & Notecards

Revolution Perenti
Registered User
Join date: 26 Nov 2006
Posts: 8
08-26-2007 23:45
ok hope someone can help as my script is w.i.p still now i have basic notecard seems to be reading and added a expierment listen.
and now it works like /channel load ObjectName

CODE

list objectSettings = [];
integer stride = 3;

integer iLine = 0;

string CONFIG_CARD = "configuration"; //objectname|<position>|<rotation>
integer chatHandle;
default
{
on_rez(integer start)
{
llResetScript();
}

state_entry()
{
state initialize;

}
}

state initialize
{
state_entry()
{
llGetNotecardLine(CONFIG_CARD, iLine);
}

dataserver(key queryId, string data)
{
if(data != EOF)
{
objectSettings += llParseString2List(data, ["|"], []);
iLine++;
llGetNotecardLine(CONFIG_CARD, iLine);
}
else
{
state operate;
}
}
}

state operate
{
state_entry()
{
chatHandle = llListen(24, "", NULL_KEY, "");
}

listen(integer channel, string name, key id, string message)
{
list command = llParseString2List(message, [" "], [""]);
if(llList2String(command, 0) == "load")
{
string object = llList2String(command, 1);
integer indexInSettings = llListFindList(objectSettings, [object]);
if(indexInSettings >= 0)
{
vector pos = (vector)llList2String(objectSettings, indexInSettings + 1);
rotation rot = (rotation)llList2String(objectSettings, indexInSettings + 2);
llRezObject(object, pos + llGetPos(), <0, 0, 0>, rot, 0);
}
}
}
}


ok now i want to be able to change /load objectname to say load a notecard so this part not a problem but anyone know how i can make all the lines in the notecard rez when called.

say i load notecard a like /channel notecard set1
and everything in the notecard is rezzed when called in one go

hope someone can help becuase im out of idears

Rev :)
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
08-27-2007 01:33
Why reinvent the wheel when all you need to do is head over to the Furnation Worlds Mall, find the "Nuts'n'Carrots" store (its on the south border) and get the MultiRoom Script set...

It basically does what you want and works estate wide.

You can look up the location in my profile if needed.
Revolution Perenti
Registered User
Join date: 26 Nov 2006
Posts: 8
08-27-2007 13:46
well i already made memory based system now im making notecard version and its open source and free for all , think i got it now tho,
been scripting way too much everyday fro last few months on so many different projects
Boss Spectre
Registered User
Join date: 5 Sep 2005
Posts: 229
08-28-2007 00:37
Here you go, this is how I might add the notecard rez function to your script (untested since I dont have your notecards or objects):

CODE

list objectSettings = [];
integer stride = 3;

integer iLine = 0;

string CONFIG_CARD = "configuration"; // objectname|<position>|<rotation>
// BLOCK ADDED TO REZ FROM NOTE
key config_query; // query ID for config notecard
string rez_card = ""; // note containing list of objects to rez all at once
key rez_query; // query ID for contents of rez list note
// END BLOCK ADDED TO REZ FROM NOTE
integer chatHandle;
default
{
on_rez(integer start)
{
llResetScript();
}

state_entry()
{
state initialize;

}
}

state initialize
{
state_entry()
{
config_query = llGetNotecardLine(CONFIG_CARD, iLine);
}

dataserver(key queryId, string data)
{
if (queryId == config_query)
{
if(data != EOF)
{
objectSettings += llParseString2List(data, ["|"], []);
iLine++;
config_query = llGetNotecardLine(CONFIG_CARD, iLine);
}
else
{
state operate;
}
}
}
}

state operate
{
state_entry()
{
chatHandle = llListen(24, "", NULL_KEY, "");
}

listen(integer channel, string name, key id, string message)
{
list command = llParseString2List(message, [" "], [""]);
if(llList2String(command, 0) == "load")
{
string object = llList2String(command, 1);
integer indexInSettings = llListFindList(objectSettings, [object]);
if(indexInSettings >= 0)
{
vector pos = (vector)llList2String(objectSettings, indexInSettings + 1);
rotation rot = (rotation)llList2String(objectSettings, indexInSettings + 2);
llRezObject(object, pos + llGetPos(), <0, 0, 0>, rot, 0);
}
}
// BLOCK ADDED TO REZ FROM NOTE
else if(llList2String(command, 0) == "notecard")
{
string object = llList2String(command, 1);
if (llGetInventoryType(object) != INVENTORY_NOTECARD) // if note not found
{
llInstantMessage(id, "ERROR - notecard \"" + object + "\" not found!");
return;
}
rez_card = object; // store note name for further reading
iLine = 0;
rez_query = llGetNotecardLine(rez_card, iLine);
}
// END BLOCK ADDED TO REZ FROM NOTE
}
// BLOCK ADDED TO REZ FROM NOTE
dataserver(key queryId, string data)
{
if (queryId == config_query)
{
if(data != EOF)
{
list rez = llParseString2List(data, ["|"], []);
if (llGetListLength(rez) == 3)
{
vector pos = (vector)llList2String(rez, 1);
rotation rot = (rotation)llList2String(rez, 2);
llRezObject(llList2String(rez, 0), pos + llGetPos(), ZERO_VECTOR, rot, 0);
}

iLine++;
rez_query = llGetNotecardLine(rez_card, iLine);
}
}
}
// END BLOCK ADDED TO REZ FROM NOTE
}


Since there are now multiple cards being read, I added checks throughout for the queryId to be sure that the dataserver event is dealing with the correct data.

On a side note, you might also wish to alter the rez pos/rotation based on the rezzer's rotation, something like this:

llRezObject(llList2String(rez, 0), llGetPos() + (pos * llGetRot()), ZERO_VECTOR, rot * llGetRot(), 0);