Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help with an elevator script

Levi Bruun
Registered User
Join date: 16 May 2009
Posts: 11
05-30-2009 21:47
I have the Elevator Pro 4.0 from XStreet and have a question for you scripters. I have this elevator in a boxed Skypad that shots you in the sky 300m then leaves you standing on a simple platform that you use to rez the rest of the building with. Well that's all working great but the elevator resets every time I rez the building. It does say you can place a notecard in the elevator to remember the positions of the floors and that works till you delete the building and then rez it at a new location then the floor positions (well the X and the Y) are wrong. Here is an example of the notecard used to remember the floors its really simple but the script is crazy long for a newbie like me...hehe

+:<170.553436, 73.580376, 1694.286133>:
+:<170.553436, 73.580376, 1699.516968>:

You put the two lines above into the elevator and name it "elproconfig" that is how it remembers the floor positions. Is there a way to get it to just remember the Z position and then just use the default Y and X from the position its in when its rezzed? If you can help me with this or point me to an easy solution that would be great. The script is to large to post here i guess. :(

Edit: Ok, got it loaded up if anyone can help that would be great.
Edit: Deleted the script from the post as the issue has been resolved and it was such a long script....Void is my new hero...haha
Levi Bruun
Registered User
Join date: 16 May 2009
Posts: 11
05-30-2009 21:51
// default values.
integer chatchannel = 12000; // elevator chat channel.
integer sitball = FALSE; // TRUE = show sit ball, FALSE = don´t show sit ball.
integer sittext = TRUE; // TRUE = show sit text, FALSE = don´t show sit text.
integer unsittime = 5; // time to unsit avatar after arrive at selected floor.
integer voices = 0; // voices lenguaje, 0=english, 1=spanish.

// elevator data.
integer nfloors = 0; // number of floors.
list floorsposition = []; // list with vectors for every floor.
list floorsperms = []; // stores permisions for every floor.

// working data.
integer channelID; // id for the chat channel.
integer targetID; // target identification.
vector newpos; // new position when a floor is selected.

integer actualfloor = 0; // floor where the elevator is.
integer newfloor = 0; // selected floor.

integer elevatorstate = 0; // elevatorstate; = 0, stoped.
// = 1, going up.
// = 2, going down.

integer sitted = FALSE; // TRUE if an avatar is sitted, FALSE otherwise.

key sittedid = NULL_KEY; // Key of sitted avatar.

integer timeouttimer = 10;

integer menulocked = TRUE; // if TRUE, working menu is locked, if FALSE, working menu active.

integer rezbox = FALSE; // for rezzing doors.
integer rezzing = FALSE;

// Variables for notecard reading
integer note_line = 0;
key note_queryID;

// Read data from the configuration notecard if
// present.
// --------------------------------------------

readconfignote()
{
if (llGetInventoryType("elproconfig";) == INVENTORY_NOTECARD)
{
nfloors = 0;
floorsposition = [];
floorsperms = [];
llOwnerSay("Reading configuration notecard.";);
llOwnerSay("------------------------------------------------";);
note_queryID = llGetNotecardLine("elproconfig", note_line);
}
else llOwnerSay("There is not a configuration notecard.";);
}

// parse lines readed from notecard.

parsenoteline(string line)
{
list items = llParseString2List(line, [":"], []);

if (llList2String(items, 0) == "+";)
{
floorsposition = floorsposition + [(vector)llList2String(items, 1)];
floorsperms = floorsperms + llList2String(items, 2);
nfloors++;
}
}

// Parses the configuration data if pressent in object
// description field and returns TRUE.
// If not pressent, returns FALSE.
// ------------------------------------------------------

readconfig()
{
string confstr = llGetObjectDesc();
list items = llParseString2List(confstr, [","], []);

chatchannel = (integer)llList2String(items, 1);
sitball = (integer)llList2String(items, 2);
sittext = (integer)llList2String(items, 5);

if (sitball) llMessageLinked(LINK_ALL_CHILDREN, 0, "SITBALLSHOW", NULL_KEY);
else llMessageLinked(LINK_ALL_CHILDREN, 0, "SITBALLHIDE", NULL_KEY);

if (sittext) llMessageLinked(LINK_ALL_CHILDREN, 0, "SITTEXTSHOW", NULL_KEY);
else llMessageLinked(LINK_ALL_CHILDREN, 0, "SITTEXTHIDE", NULL_KEY);

unsittime = (integer)llList2String(items, 3);
voices = (integer)llList2String(items, 4);
}

// Saves the configuration data in the description field.
// ------------------------------------------------------

saveconfig()
{
string theconfig = "conf," + (string)chatchannel + "," + (string)sitball + "," +
(string)unsittime + "," + (string)voices + "," + (string)sittext;

llSetObjectDesc(theconfig);
}

// Says the config to the owner.
// ------------------------------------------------------

sayconfig()
{
llOwnerSay("MWS Elevator PRO 2.0 CONFIG DATA";);
llOwnerSay("------------------------------------------------";);
llOwnerSay("Chatchannel: " + (string)chatchannel);
llOwnerSay("Show sit ball (1 = show, 0 = no): " + (string)sitball);
llOwnerSay("Unsit time: " + (string)unsittime);
llOwnerSay("Voices (0 = none, 1 = english, 2 = spanish): " + (string)voices);
llOwnerSay("------------------------------------------------";);
llOwnerSay("Number of floors: " + (string)nfloors);
llOwnerSay("------------------------------------------------";);
}

// Rezzes doors and external boxes from ground floor, to
// top floor
// ---------------------------------------------------------

rezzdoors(integer wfloor)
{
// Take data about pos and rot of elevator.

vector elevatorpos = llGetPos();
rotation elevatorrot = llGetRot();

vector objVdest;
rotation objRdest;

integer rezvalue = (chatchannel * 10) + wfloor;

if (llGetInventoryType("Elevator PRO 2.0 Classic (door)";) == INVENTORY_OBJECT)
{

// Calculate final destination and rotation.

objVdest = ( <1.85477, -0.00000, 1.76199> * elevatorrot) + elevatorpos;
objRdest = (<0.00000, 0.00000, 1.00000, 0.00000> * elevatorrot);

// Rez door in proper position.

llRezAtRoot("Elevator PRO 2.0 Classic (door)",objVdest,ZERO_VECTOR,objRdest,rezvalue);
llSleep (1.0);
} else llOwnerSay("Elevator door not in elevator inventory.";);

if (rezbox) {
if (llGetInventoryType("Elevator PRO 2.0 Classic (external box)";) == INVENTORY_OBJECT)
{

// Calculate final destination and rotation.

objVdest = (<0.00537, -0.00000, 1.76840> * elevatorrot) + elevatorpos;
objRdest = (<0.0, 0.0, 0.70711, 0.70711> * elevatorrot);

// Rez ext box in proper position.

llRezAtRoot("Elevator PRO 2.0 Classic (external box)",objVdest,ZERO_VECTOR,objRdest,0);
llSleep(1.0);
} else llOwnerSay("External box not in elevator inventory.";);
}

llOwnerSay("REZZED at floor: " + (string)wfloor);

// if not finished, send the elevator to the next floor.

if (wfloor < (nfloors - 1))
{
wfloor++;
sendtofloor(wfloor);
}
else
{
rezzing = FALSE;
llOwnerSay("REZZING FINISHED";);
sendtofloor(0);
}

}

// Sends the elevator to a selected floor if floors has been
// configured.
// ---------------------------------------------------------

sendtofloor(integer floor)
{
if (voices == 1)
llTriggerSound((string)floor + "flooreng", 0.0);

if (voices == 2)
llTriggerSound((string)floor + "flooresp", 0.0);

if (nfloors > 0)
{
newfloor = floor;


// looks for permissions

if (sittedid != llGetOwner())
{
if (sittedid != NULL_KEY)
{
if ((llList2String(floorsperms, newfloor) == "owner";) && (sittedid != llGetOwner()))
{
llWhisper(0, "SORRY!!!, only the owner can go to that floor. Use the";);
llWhisper(0, "internal touch panel to select another floor.";);
timeouttimer = unsittime;
return;
}

if ((llList2String(floorsperms, newfloor) == "group";) && (!llSameGroup(sittedid)))
{
llWhisper(0, "SORRY!!!, only the members of the group can go to that floor.";);
llWhisper(0, " Use the internal touch panel to select another floor.";);
timeouttimer = unsittime;
return;
}
}
}

if ((newfloor != actualfloor) || (rezzing))
{
newpos = llList2Vector(floorsposition, newfloor);

if (!rezzing) llLoopSound("elevator", 1.0);

if (newfloor > actualfloor)
{
elevatorstate = 1; // going up.
llRegionSay(chatchannel, "ELPRO2.0:" + (string)llGetOwner() + ":GOINGUP";);
llMessageLinked(LINK_ALL_CHILDREN, 0, "GOINGUP", NULL_KEY);
}
else
{
elevatorstate = 2; // going down.
llRegionSay(chatchannel, "ELPRO2.0:" + (string)llGetOwner() + ":GOINGDOWN";);
llMessageLinked(LINK_ALL_CHILDREN, 0, "GOINGDOWN", NULL_KEY);
}

llWhisper(0, "To Floor " + (string)floor);
targetID = llTarget(newpos, 0.2);
llSetPos(newpos);

}
else llWhisper(0, "You are at floor " + (string)floor);

} else llSay(0, "No configured floors.";);
}

// *****************************************************************************
//
Levi Bruun
Registered User
Join date: 16 May 2009
Posts: 11
05-30-2009 21:57
// default values.
integer chatchannel = 12000; // elevator chat channel.
integer sitball = FALSE; // TRUE = show sit ball, FALSE = don´t show sit ball.
integer sittext = TRUE; // TRUE = show sit text, FALSE = don´t show sit text.
integer unsittime = 5; // time to unsit avatar after arrive at selected floor.
integer voices = 0; // voices lenguaje, 0=english, 1=spanish.

// elevator data.
integer nfloors = 0; // number of floors.
list floorsposition = []; // list with vectors for every floor.
list floorsperms = []; // stores permisions for every floor.

// working data.
integer channelID; // id for the chat channel.
integer targetID; // target identification.
vector newpos; // new position when a floor is selected.

integer actualfloor = 0; // floor where the elevator is.
integer newfloor = 0; // selected floor.

integer elevatorstate = 0; // elevatorstate; = 0, stoped.
// = 1, going up.
// = 2, going down.

integer sitted = FALSE; // TRUE if an avatar is sitted, FALSE otherwise.

key sittedid = NULL_KEY; // Key of sitted avatar.

integer timeouttimer = 10;

integer menulocked = TRUE; // if TRUE, working menu is locked, if FALSE, working menu active.

integer rezbox = FALSE; // for rezzing doors.
integer rezzing = FALSE;

// Variables for notecard reading
integer note_line = 0;
key note_queryID;

// Read data from the configuration notecard if
// present.
// --------------------------------------------

readconfignote()
{
if (llGetInventoryType("elproconfig";) == INVENTORY_NOTECARD)
{
nfloors = 0;
floorsposition = [];
floorsperms = [];
llOwnerSay("Reading configuration notecard.";);
llOwnerSay("------------------------------------------------";);
note_queryID = llGetNotecardLine("elproconfig", note_line);
}
else llOwnerSay("There is not a configuration notecard.";);
}

// parse lines readed from notecard.

parsenoteline(string line)
{
list items = llParseString2List(line, [":"], []);

if (llList2String(items, 0) == "+";)
{
floorsposition = floorsposition + [(vector)llList2String(items, 1)];
floorsperms = floorsperms + llList2String(items, 2);
nfloors++;
}
}

// Parses the configuration data if pressent in object
// description field and returns TRUE.
// If not pressent, returns FALSE.
// ------------------------------------------------------

readconfig()
{
string confstr = llGetObjectDesc();
list items = llParseString2List(confstr, [","], []);

chatchannel = (integer)llList2String(items, 1);
sitball = (integer)llList2String(items, 2);
sittext = (integer)llList2String(items, 5);

if (sitball) llMessageLinked(LINK_ALL_CHILDREN, 0, "SITBALLSHOW", NULL_KEY);
else llMessageLinked(LINK_ALL_CHILDREN, 0, "SITBALLHIDE", NULL_KEY);

if (sittext) llMessageLinked(LINK_ALL_CHILDREN, 0, "SITTEXTSHOW", NULL_KEY);
else llMessageLinked(LINK_ALL_CHILDREN, 0, "SITTEXTHIDE", NULL_KEY);

unsittime = (integer)llList2String(items, 3);
voices = (integer)llList2String(items, 4);
}

// Saves the configuration data in the description field.
// ------------------------------------------------------

saveconfig()
{
string theconfig = "conf," + (string)chatchannel + "," + (string)sitball + "," +
(string)unsittime + "," + (string)voices + "," + (string)sittext;

llSetObjectDesc(theconfig);
}

// Says the config to the owner.
// ------------------------------------------------------

sayconfig()
{
llOwnerSay("MWS Elevator PRO 2.0 CONFIG DATA";);
llOwnerSay("------------------------------------------------";);
llOwnerSay("Chatchannel: " + (string)chatchannel);
llOwnerSay("Show sit ball (1 = show, 0 = no): " + (string)sitball);
llOwnerSay("Unsit time: " + (string)unsittime);
llOwnerSay("Voices (0 = none, 1 = english, 2 = spanish): " + (string)voices);
llOwnerSay("------------------------------------------------";);
llOwnerSay("Number of floors: " + (string)nfloors);
llOwnerSay("------------------------------------------------";);
}

// Rezzes doors and external boxes from ground floor, to
// top floor
// ---------------------------------------------------------

rezzdoors(integer wfloor)
{
// Take data about pos and rot of elevator.

vector elevatorpos = llGetPos();
rotation elevatorrot = llGetRot();

vector objVdest;
rotation objRdest;

integer rezvalue = (chatchannel * 10) + wfloor;

if (llGetInventoryType("Elevator PRO 2.0 Classic (door)";) == INVENTORY_OBJECT)
{

// Calculate final destination and rotation.

objVdest = ( <1.85477, -0.00000, 1.76199> * elevatorrot) + elevatorpos;
objRdest = (<0.00000, 0.00000, 1.00000, 0.00000> * elevatorrot);

// Rez door in proper position.

llRezAtRoot("Elevator PRO 2.0 Classic (door)",objVdest,ZERO_VECTOR,objRdest,rezvalue);
llSleep (1.0);
} else llOwnerSay("Elevator door not in elevator inventory.";);

if (rezbox) {
if (llGetInventoryType("Elevator PRO 2.0 Classic (external box)";) == INVENTORY_OBJECT)
{

// Calculate final destination and rotation.

objVdest = (<0.00537, -0.00000, 1.76840> * elevatorrot) + elevatorpos;
objRdest = (<0.0, 0.0, 0.70711, 0.70711> * elevatorrot);

// Rez ext box in proper position.

llRezAtRoot("Elevator PRO 2.0 Classic (external box)",objVdest,ZERO_VECTOR,objRdest,0);
llSleep(1.0);
} else llOwnerSay("External box not in elevator inventory.";);
}

llOwnerSay("REZZED at floor: " + (string)wfloor);

// if not finished, send the elevator to the next floor.

if (wfloor < (nfloors - 1))
{
wfloor++;
sendtofloor(wfloor);
}
else
{
rezzing = FALSE;
llOwnerSay("REZZING FINISHED";);
sendtofloor(0);
}

}

// Sends the elevator to a selected floor if floors has been
// configured.
// ---------------------------------------------------------

sendtofloor(integer floor)
{
if (voices == 1)
llTriggerSound((string)floor + "flooreng", 0.0);

if (voices == 2)
llTriggerSound((string)floor + "flooresp", 0.0);

if (nfloors > 0)
{
newfloor = floor;


// looks for permissions

if (sittedid != llGetOwner())
{
if (sittedid != NULL_KEY)
{
if ((llList2String(floorsperms, newfloor) == "owner";) && (sittedid != llGetOwner()))
{
llWhisper(0, "SORRY!!!, only the owner can go to that floor. Use the";);
llWhisper(0, "internal touch panel to select another floor.";);
timeouttimer = unsittime;
return;
}

if ((llList2String(floorsperms, newfloor) == "group";) && (!llSameGroup(sittedid)))
{
llWhisper(0, "SORRY!!!, only the members of the group can go to that floor.";);
llWhisper(0, " Use the internal touch panel to select another floor.";);
timeouttimer = unsittime;
return;
}
}
}

if ((newfloor != actualfloor) || (rezzing))
{
newpos = llList2Vector(floorsposition, newfloor);

if (!rezzing) llLoopSound("elevator", 1.0);

if (newfloor > actualfloor)
{
elevatorstate = 1; // going up.
llRegionSay(chatchannel, "ELPRO2.0:" + (string)llGetOwner() + ":GOINGUP";);
llMessageLinked(LINK_ALL_CHILDREN, 0, "GOINGUP", NULL_KEY);
}
else
{
elevatorstate = 2; // going down.
llRegionSay(chatchannel, "ELPRO2.0:" + (string)llGetOwner() + ":GOINGDOWN";);
llMessageLinked(LINK_ALL_CHILDREN, 0, "GOINGDOWN", NULL_KEY);
}

llWhisper(0, "To Floor " + (string)floor);
targetID = llTarget(newpos, 0.2);
llSetPos(newpos);

}
else llWhisper(0, "You are at floor " + (string)floor);

} else llSay(0, "No configured floors.";);
}

// *****************************************************************************
Levi Bruun
Registered User
Join date: 16 May 2009
Posts: 11
05-30-2009 21:58
// *****************************************************************************

default
{
on_rez(integer parameters)
{
llResetScript();
}

state_entry()
{
// first looks if elevator is configured with parameters in
// description field, if not, configure it.

string confstr = llGetObjectDesc();
list items = llParseString2List(confstr, [","], []);

if (llList2String(items, 0) != "conf";) saveconfig();

// reads configuration and says it to the owner.

readconfig();
sayconfig();

// open chatchannel.
channelID = llListen(chatchannel, "", NULL_KEY, "";);

llSetSitText("Elevator";);
llSitTarget(<0.0,0.0,1.0>,llEuler2Rot(<0.0, 0.0, 0.0>;));
llSetCameraEyeOffset(<-1.0, 0.1, 1.7>;);
llSetCameraAtOffset(<0.1, -0.5, 1.8>;);

readconfignote();

llOwnerSay("Elevator PRO Ready!";);
}

// ------------------------------------------------
// if agent touches the floor, and menu is unlocked
// shows him the main menu.
// ------------------------------------------------

touch_start(integer total_number)
{
if ((llDetectedKey(0) == llGetOwner()) && (!menulocked))
llDialog(llGetOwner(), "MAIN MENU",
["SendTo", "Floors", "Config", "INSTALL"], chatchannel);
}

// ------------
// listen event
// ------------

listen(integer channel, string name, key id, string message)
{
list items = llParseString2List(message, [":"], []);
string command = llList2String(items, 0);
integer loop;
vector tposition;
list floorsdialog;

// commands from chatchannel.
// --------------------------

if (channel == chatchannel)
{
// commands from the owner. can be from chat window or lldialog
// ------------------------------------------------------------
if (id == llGetOwner())
{
// from the owner in chat window.
// ------------------------------
if (command == "elpro20 menu unlock";) // wants to unlock the menu.
{
menulocked = FALSE;
llOwnerSay("Configuration menu is UNLOCKED";);
return;
}

if (command == "elpro20 menu lock";) // wants to lock the menu.
{
menulocked = TRUE;
llOwnerSay("Configuration menu is LOCKED";);
return;
}

if (command == "elpro20 menu";) // wants to know menu state.
{
if (menulocked) llOwnerSay("Configuration menu is LOCKED";);
else llOwnerSay("Configuration menu is UNLOCKED";);
}

if (!menulocked) // *** Only if menu is unlocked. *****
{
// from chat window commands.
// --------------------------

if ((command == "elpro20";) && (llList2String(items, 1) == "sittime";))
{
unsittime = (integer)llList2String(items, 2);
llOwnerSay("Configured new value for unsit time: " + (string)unsittime);
saveconfig();
}

if ((command == "elpro20";) && (llList2String(items, 1) == "channel";))
{
llRegionSay(chatchannel, "ELPRO2.0:" + (string)llGetOwner() + ":CHANNEL:" + llList2String(items, 2));
chatchannel = (integer)llList2String(items, 2);
llOwnerSay("Configured new value for chatchannel: " + (string)chatchannel);
llOwnerSay(">>> REMEMBER <<< from now, you have to use the new chat channel.";);
llOwnerSay("Remember to verify that every installed door has changed properly and that";);
llOwnerSay("new doors will be rezzed with the new chat channel configure.";);
llListenRemove(channelID);
channelID = llListen(chatchannel, "", NULL_KEY, "";);
saveconfig();
}

if ((command == "elpro20";) && (llList2String(items, 1) == "delete";) && (llList2String(items, 2) == "doors";))
llRegionSay(chatchannel, "ELPRO2.0:" + (string)llGetOwner() + ":DELETE";);

// from lldialog.
// --------------

if (command == "SendTo";)
{
for (loop = 0; loop < nfloors; ++loop) floorsdialog = floorsdialog + ["SEND:" + (string)loop];
llDialog(llGetOwner(), "ADJUST FLOOR POSITION", floorsdialog, chatchannel);
}

if (command == "Floors";)
llDialog(llGetOwner(), "FLOORS MENU", ["Show List", "Add New", "Adjust"], chatchannel);

if (command == "Config";)
llDialog(llGetOwner(), "CONFIG MENU", ["Show", "SitBall", "SitText", "UnsitTime", "Voices", "Channel"], chatchannel);

if (command == "INSTALL";)
llDialog(llGetOwner(), "INSTALLATION MENU", ["WITHExtBox", "NOExtBox", "DEL.DOORS"], chatchannel);

// sento suboptions.
// -----------------

if (llList2String(items, 0) == "SEND";) // Sends the elevator to a selected floor.
sendtofloor((integer)llList2String(items, 1));

// floors suboptions.
// -------------------

if (command == "Show List";) // Shows the user the list of floors.
{
llOwnerSay("------------------------------------------------";);
llOwnerSay("Number of floors: " + (string)nfloors);
llOwnerSay("------------------------------------------------";);

for (loop = 0; loop < nfloors; loop++)
llOwnerSay("+:" + llList2String(floorsposition, loop) + ":" + llList2String(floorsperms, loop));

llOwnerSay("------------------------------------------------";);
}

if (command == "Add New";) // Add this position as new floor.
{ // if altitude is below 760m.
if (nfloors < 10)
{
tposition = llGetPos();
if (tposition.z < 4090)
{
floorsposition = floorsposition + llGetPos();
llOwnerSay("Stored position for floor " + (string)nfloors + " at " + (string)llGetPos());
nfloors++;
actualfloor = nfloors - 1;
}
else llOwnerSay("Too high, elevator can not go over 4090m altitude.";);
} else llOwnerSay("Floors limit reached.";);
}

if (command == "Adjust";) // Adjusts the position of a floor.
{
for (loop = 0; loop < nfloors; ++loop) floorsdialog = floorsdialog + ["F:" + (string)loop];
llDialog(llGetOwner(), "ADJUST FLOOR POSITION", floorsdialog, chatchannel);
}

if (llList2String(items, 0) == "F";) // Adjusts position of a floor.
{
integer floorp = (integer)llList2String(items, 1);
floorsposition = llListReplaceList(floorsposition, [llGetPos()], floorp, floorp);

llOwnerSay("Adjusted position for floor: " + (string)floorp);
}

// config suboptions.
// ----------------
Levi Bruun
Registered User
Join date: 16 May 2009
Posts: 11
05-30-2009 21:59
if (command == "Show";) sayconfig(); // Shows configuration to the owner.

if (command == "SitBall";) // Configures if sit ball will be shown.
{
if (sitball)
{
sitball = FALSE;
llMessageLinked(LINK_ALL_CHILDREN, 0, "SITBALLHIDE", NULL_KEY);
llOwnerSay("Sit ball HIDED";);
}
else
{
sitball = TRUE;
llMessageLinked(LINK_ALL_CHILDREN, 0, "SITBALLSHOW", NULL_KEY);
llOwnerSay("Sit ball SHOW";);
}
saveconfig();

}

if (command == "SitText";) // Configures if sit text will be shown.
{
if (sittext)
{
sittext = FALSE;
llMessageLinked(LINK_ALL_CHILDREN, 0, "SITTEXTHIDE", NULL_KEY);
llOwnerSay("Sit text HIDED";);
}
else
{
sittext = TRUE;
llMessageLinked(LINK_ALL_CHILDREN, 0, "SITTEXTSHOW", NULL_KEY);
llOwnerSay("Sit text SHOW";);
}
saveconfig();
}

if (command == "UnsitTime";) // Configures unsit time.
{
llOwnerSay("Write in chat window \"/CHAN elpro20:sittime:XX\" where CHAN is the chatchannel";);
llOwnerSay("of the elevator, and XX the new value in seconds.";);
}

if (command == "Voices";) // Show voices submenu.
llDialog(llGetOwner(), "SELECT VOICE LENGUAJE", ["None", "English", "Spanish"], chatchannel);

if (command == "Channel";) // Configures chat channel.
{
llOwnerSay("Write in chat window \"/CHAN elpro20:channel:XXXXX\" where CHAN is the actual chatchannel";);
llOwnerSay("of the elevator, and XXXXX the new channel.";);
}

// Voices suboptions.
// ------------------

if (command == "None";) // No voices.
{
voices = 0;
saveconfig();
llOwnerSay("Configured without voices.";);
}

if (command == "English";) // English voices.
{
voices = 1;
saveconfig();
llOwnerSay("Configured for ENGLISH voices.";);
}

if (command == "Spanish";) // Spanish voices.
{
voices = 2;
saveconfig();
llOwnerSay("Configured for SPANISH voices.";);
}

// installation suboptions.
// ------------------------
Levi Bruun
Registered User
Join date: 16 May 2009
Posts: 11
05-30-2009 21:59
if (command == "WITHExtBox";) // Rezzes a door at every floor and an external box.
llDialog (llGetOwner(), "Rezz Doors WITH External Box ???", ["YES.REZBOX"], chatchannel);

if (command == "NOExtBox";) // Rezzes a door at every floor without external box.
llDialog (llGetOwner(), "Rezz Doors WITHOUT External Box ???", ["YES.REZNOBOX"], chatchannel);

if (command == "YES.REZBOX";)
{
rezbox = TRUE;
rezzing = TRUE;
sendtofloor(0);
}

if (command == "YES.REZNOBOX";)
{
rezbox = FALSE;
rezzing = TRUE;
sendtofloor(0);
}

if (command == "DEL.DOORS";)
{
llOwnerSay("Write in chat window \"/CHAN elpro20:delete:doors\" where CHAN is the actual chatchannel";);
llOwnerSay("of the elevator. Door at every floor will be deleted.";);
}
}

}

// commands from doors or internal pannel.
// ------------------------------------------------------------

if ((llList2String(items, 0) == "ELPRO2.0";) && (llList2String(items, 1) == (string)llGetOwner()))
{
if (llList2String(items, 2) == "CALL";)
{
if ((sitted == FALSE) && (elevatorstate == 0))
{
llWhisper(0,"Call from floor " + llList2String(items, 3) + ".Please Wait.";);
llSetTimerEvent(0.0);
sendtofloor((integer)llList2String(items, 3));
}
else llRegionSay(chatchannel, "ELPRO2.0:" + (string)llGetOwner() + ":BUSY";);
}
}

if ((llList2String(items, 0) == "FLOOR";) && (sitted)) // Sends the elevator to a selected floor.
sendtofloor((integer)llList2String(items, 1));
}

}

link_message(integer sender, integer num, string message, key id)
{
integer loop;
list floorsdialog;

if ((message == "IBUT";) && (sitted) && (elevatorstate == 0))
{
timeouttimer = unsittime;
for (loop = 0; loop < nfloors; ++loop) floorsdialog = floorsdialog + ["FLOOR:" + (string)loop];
llDialog(sittedid, "SELECT FLOOR", floorsdialog, chatchannel);
}

}

at_target(integer tnum, vector tpos, vector opos)
{
elevatorstate = 0;
actualfloor = newfloor;

llTargetRemove(targetID);
llStopSound();

if (!rezzing)
{

llSleep(0.5);
llPlaySound("ding", 1.0);

timeouttimer = unsittime;
llSetTimerEvent(1.0);

llMessageLinked(LINK_ALL_CHILDREN, actualfloor, "ARRIVED", NULL_KEY);
llMessageLinked(LINK_ALL_CHILDREN, actualfloor, "ATFLOOR", NULL_KEY);
llRegionSay(chatchannel, "ELPRO2.0:" + (string)llGetOwner() + ":ARRIVED:" + (string)actualfloor);
llRegionSay(chatchannel, "ELPRO2.0:" + (string)llGetOwner() + ":ATFLOOR:" + (string)actualfloor);

llSleep(0.5);

if (voices == 1)
llTriggerSound((string)actualfloor + "flooreng", 1.0);

if (voices == 2)
llTriggerSound((string)actualfloor + "flooresp", 1.0);
}
else rezzdoors(actualfloor);
}


not_at_target()
{
llSetPos(newpos);
}

timer()
{
--timeouttimer;
if ((timeouttimer == 0) && (elevatorstate == 0))
{
llUnSit(sittedid);
llSetTimerEvent(0.0);
sitted = FALSE;
}
}

// Data server event to read every line inside the notecard.

dataserver(key queryID, string rline)
{
if (queryID == note_queryID)
{
if (rline != EOF) // not the end of the notecard.
{
parsenoteline(rline);
++note_line;
note_queryID = llGetNotecardLine("elproconfig", note_line);
}
else llOwnerSay("Number of floors: " + (string)nfloors);
}
}

// If something changes in inventory of elevator, autoreset script.

changed(integer change)
{
integer loop;
list floorsdialog;

if (change & CHANGED_INVENTORY) llResetScript();

if (change & CHANGED_LINK)
{
sittedid = llAvatarOnSitTarget();

if ( sittedid != NULL_KEY)
{
llWhisper(0, "Hi! " + llKey2Name(sittedid) + ".";);
for (loop = 0; loop < nfloors; ++loop) floorsdialog = floorsdialog + ["FLOOR:" + (string)loop];
llDialog(sittedid, "SELECT FLOOR", floorsdialog, chatchannel);
llMessageLinked(LINK_ALL_CHILDREN, 0, "SITBALLHIDE", NULL_KEY);
sitted = TRUE;
timeouttimer = unsittime;
llSetTimerEvent(1.0);
}
else
{
if (sitball) llMessageLinked(LINK_ALL_CHILDREN, 0, "SITBALLSHOW", NULL_KEY);
llWhisper(0, "Bye! Have a good day.";);
llSetTimerEvent(0.0);
sitted = FALSE;
}
}
}

}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-30-2009 23:50
as a bare minimum modification that isn't going to upset an script structure....

change this
CODE

newpos = llList2Vector(floorsposition, newfloor);


to this
CODE

newpos = llGetPos();
vector temp = llList2Vector(floorsposition, newfloor);
newpos.z = temp.z


preferably you've just save the z attribute in the config read, convert it to a float when getting it from the notecard, change the references to the z property to just be direct, and all the additions to be just the z value, and apply it directly in "newpos.z =" without needing a temp variable... if you search floorsposition in the code you'll find all the place where it's read and written.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Levi Bruun
Registered User
Join date: 16 May 2009
Posts: 11
05-31-2009 08:11
Worked perfectly thanks so much.


Edit: I have deleted the script from the above post as it was so long and was not needed anymore