Discussion: Single Neat Elavator
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
04-01-2006 20:01
From: Seagel Neville It became to recall run_time_permissions again when you stood up.  When you stood up, you relased the floor selction information, then it started again and warned. I couldn't manage to fix it. Plz wait untill the next release, 1.9.0(20), which will be released the week of April 3. I hope it will be fixed. You should make run-time-permissions serially reusable. If the permissions granted change when the rider stands (which showed up in 1.9 preview, and will eventually return when they fix the teleporting problems in some way or another), then you should expect to recieve a new permissions event, so check that the permissions you recieve are the ones you expect. The change in 1.9.0(20) is related to run_time_permissions that were never requested, relating (it seems) to some changes in cameras and controls. Don't assume that all unexpected run_time_permissions events will go away. When requested permissions change you should recieve notice. Your code should request permission in the change event, not the touch event, so that the touch event actions don't have to be hidden in run_time_permissions.
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
04-01-2006 23:51
From: Argent Stonecutter Don't assume that all unexpected run_time_permissions events will go away. When requested permissions change you should recieve notice. Thank you for informing me that. I was afraid of that. From: Argent Stonecutter Your code should request permission in the change event, not the touch event, so that the touch event actions don't have to be hidden in run_time_permissions. The point of the touch event is to get the height of avatars. Without doing it, some avatars feet would float or would sink in the floor. Can I get the height and then sit in the change event? Plz help me. 
_____________________
 Seagel Neville 
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
04-02-2006 10:29
From: Seagel Neville Thank you for informing me that. I was afraid of that.  The point of the touch event is to get the height of avatars. Without doing it, some avatars feet would float or would sink in the floor. Can I get the height and then sit in the change event? Plz help me.  Ah, clever. I'll have to file that one away. I should have read the code more carefully. This should do what you want: run_time_permissions(integer perm) { if(perm & PERMISSION_TRIGGER_ANIMATION) { Standing = TRUE; StopSitAnim(); CheckMove(); } else { Standing = FALSE; } }
listen(...) { // Existing listen code goes here CheckMove(); } And then add this routine: CheckMove() { if(FloorSelection && Standing && llAvatarOnSitTarget()) { ElevatorMove(); FloorSelection = FALSE; } }
Now the move will happen as soon as all the following things have happened... 1. There's an avatar sitting on the elevator. 2. The avatar's standing. 3. The correct floor has been selected. This is the "final check" that I talk about in the other thread. You don't do anything unless its prerequisites are met, but you attempt it whenever the prerequisites *may* be met. It's a good "defensive" way to write real-time software. That way if the guy does something silly like sitting before clicking, he may be floating but the operation will still work.
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
04-05-2006 07:44
From: Argent Stonecutter That way if the guy does something silly like sitting before clicking, he may be floating but the operation will still work. Thank you, Argent. I adopted your codes. I made sure that the caution was spoken still two times if someone got on it without clicking and still performed "impatient" animation again when you got off. But the both would be revoked when the SL update coming. The SN_Elevator(ver0.41) // Argent Stonecutter helped me to fix run_time_permission trouble, Apr 2006. Thanks. // SN_Elevator was made by Seagel Neville as public domain, Dec 2005.
list heightList = [300, 700]; // You have to put down the height of each floor here list menuList = ["2F", "3F"]; // Dialog box's list. Go along with heightList.
key av; float height; integer CHANNEL; integer HANDLE; integer FloorSelection = FALSE; vector StartPos; vector AVsize; integer Standing;
StopSitAnim() // Don't sit on the floor. ;p { llStopAnimation("sit_generic"); llStopAnimation("sit"); llStartAnimation("impatient"); // Needed keyframes of legs. } // If you want to know this more, make sure to replace this for "stand". ;p
CheckMove() { if(FloorSelection && Standing && llAvatarOnSitTarget() != NULL_KEY) { ElevatorMove(); FloorSelection = FALSE; } }
ElevatorMove() { if(FloorSelection) { llMessageLinked(LINK_ALL_CHILDREN, 0, "start", NULL_KEY); vector TargetPos = <StartPos.x, StartPos.y, StartPos.z + height>; while(llVecDist(llGetPos(), TargetPos) != 0) { llSetPos(TargetPos); } llUnSit(av); llSleep(2); while(llVecDist(llGetPos(), StartPos) != 0) { llSetPos(StartPos); } llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", NULL_KEY); } else { llUnSit(av); llWhisper(0, "Plz touch this floor and select where you go first"); } }
default { state_entry() { llSetSitText("Get on"); StartPos = llGetPos(); } on_rez(integer start_param) { llResetScript(); } changed(integer change) { if(change & CHANGED_LINK) { av = llAvatarOnSitTarget(); if(av != NULL_KEY) { llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION); } } } run_time_permissions(integer perm) { if(perm & PERMISSION_TRIGGER_ANIMATION) { Standing = TRUE; StopSitAnim(); CheckMove(); } else { Standing = FALSE; } } touch_start(integer change) { key av = llDetectedKey(0); AVsize = llGetAgentSize(av); llSitTarget(<0, 0, (AVsize.z / 2)>, ZERO_ROTATION); // Wow, don't you think this is a master touch? ;p integer CHANNEL = llRound(llFrand(1000000) - 10000000); HANDLE = llListen(CHANNEL, "", "", ""); llDialog(av, "To what floor do you go?", menuList, CHANNEL); } listen(integer channel, string name, key id, string message) { height = llList2Float(heightList, llListFindList(menuList, [message])); llListenRemove(HANDLE); // Is this a manner? FloorSelection = TRUE; } }
_____________________
 Seagel Neville 
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
04-05-2006 08:02
Since you're checking FloorSelection before calling ElevatorMove you don't need to put the same check inside ElevatorMove as well. 
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
04-05-2006 08:18
Aha, indeed. But don't you think that you need "llWhisper(0, "Plz touch this floor and select where you go first"  ; " at all? hmm... There seems not to be put it into...
_____________________
 Seagel Neville 
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
04-05-2006 09:48
hmm... Sorry, Argent. Although I checked it after updating, it became different a bit with the orignal movement. And to tell the truth, I found one solution to get back to the original movement, that is, refusing the second permission call. I'm not sure this is a decent solution. // Not sure this is the correct solution, but I managed to get this back to the original work. ;p // SN_Elevator was made by Seagel Neville as public domain, Dec 2005.
list heightList = [300, 500, 700]; // You have to put down the height of each floor here list menuList = ["2F", "3F", "Rooftop"]; // Dialog box's list. Go along with heightList.
key av; float height; integer CHANNEL; integer HANDLE; integer FloorSelection = FALSE; vector StartPos; vector AVsize; integer NoSecondPermissions;
StopSitAnim() // Don't sit on the floor. :p { llStopAnimation("sit_generic"); llStopAnimation("sit"); llStartAnimation("impatient"); // Needed keyframes of legs' parts. } // If you want to know this more, make sure to replace this for "stand". :p
ElevatorMove() { if(FloorSelection) { vector TargetPos = <StartPos.x, StartPos.y, StartPos.z + height>; while(llVecDist(llGetPos(), TargetPos) != 0) { llSetPos(TargetPos); } llUnSit(av); llSleep(1); while(llVecDist(llGetPos(), StartPos) != 0) { llSetPos(StartPos); } } else { llUnSit(av); llWhisper(0, "Plz touch this floor and select where you go first"); } }
default { state_entry() { llSetSitText("Get on"); StartPos = llGetPos(); } on_rez(integer start_param) { llResetScript(); } changed(integer change) { if(change & CHANGED_LINK) { av = llAvatarOnSitTarget(); if(av != NULL_KEY) { NoSecondPermissions = TRUE; // I hate to be recalled permission when I stand up. llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION); } } } run_time_permissions(integer perm) { if(NoSecondPermissions) { NoSecondPermissions = FALSE; StopSitAnim(); ElevatorMove(); FloorSelection = FALSE; } } touch_start(integer change) { key av = llDetectedKey(0); AVsize = llGetAgentSize(av); llSitTarget(<0, 0, (AVsize.z / 2)>, ZERO_ROTATION); // Wow, don't you think this is a master touch? :p integer CHANNEL = llRound(llFrand(1000000) - 10000000); HANDLE = llListen(CHANNEL, "", "", ""); llDialog(av, "To what floor do you go?", menuList, CHANNEL); } listen(integer channel, string name, key id, string message) { height = llList2Float(heightList, llListFindList(menuList, [message])); llListenRemove(HANDLE); // Is this a manner? FloorSelection = TRUE; } }
_____________________
 Seagel Neville 
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
04-05-2006 13:19
Your NoSecondPermissions hack only works because both responses, the solicited and unsolicited ones, come after you've requested permission. If the software is changed so that there's a run_time_permissions response before the request (for example, if they automatically grant some permission on change(CHANGED_LINK) to fix a bug somewhere) then you won't yet have your permissions the first time through.
This kind of defensive programming, where you assume the platform designer is going to misinterpret your code in the worst possible way, becomes instinctive after a few years of fixing code when it gets broken by an update. It's why I was able to take some code I wrote in the early '80s on a PDP-11 and found online 20 years later and... it compiled and ran on my Macintosh.
That's going from:
Version 7 UNIX on a 16-bit little-endian machine with 64k process address space and a < 1 MHz clock.
To:
Mac OS X 10.3 on a 32-bit big-endian machine with a 4GB process address space and a 1.42 GHz clock.
You gotta learn to think paranoid. It's worth it.
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
04-05-2006 15:51
From: Argent Stonecutter If the software is changed so that there's a run_time_permissions response before the request (for example, if they automatically grant some permission on change(CHANGED_LINK) to fix a bug somewhere) then you won't yet have your permissions the first time through. Even though if some permissions were granted before request, nothing would happen because NoSecondPermissions would just keep FALSE. It is just before request that NoSecondPermissions turns out to be TRUE. The only problem that I'm afraid is if there was a run_time_permissions response before the request and nothing after the request. But that would be called into question its raison d'etre as an event handler. I know this hack can't be used in all cases, but I want it to attention when someone sits before clicking and don't want it to speak the same thing whenever reaching the destination.
_____________________
 Seagel Neville 
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
04-06-2006 08:22
I guess.
I would still recommend, as a matter of course, using requirements and constraints rather than trying to lockstep a series of realtime events. Later on, when they get Mono and languages that support threads, you'll be glad of the habit... and it'll mean that things like this become non-issues because even if they change undocumented things you're not depending on undocumented things.
|
Dale Harmison
Registered User
Join date: 26 Dec 2005
Posts: 59
|
04-16-2006 11:22
Can the elevator go up to the floor and stay up on that floor til the person commands it to either go back down or up or whevner they want to go back up or down from that location? Maybe i missed that but if its got that feature could someone paste the whole code from the begining to the end cause im not good at scripting or changing things around in one. sry and thank you!
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
04-16-2006 19:09
From: Dale Harmison Can the elevator go up to the floor and stay up on that floor til the person commands it to either go back down or up or whevner they want to go back up or down from that location? It is possible but against the concept. I won't develop this elevator to such like that. But I will develop another elevator. It should become what you expect. I have, however, a lot of projects to do... What about using this script?
_____________________
 Seagel Neville 
|
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
|
04-24-2006 07:02
Seagel?
I finally installed my elevator, using the version of the script that you provided with the added X and Y offset factors. Many thanks again!
It works fine, though I haven't tried yet to add anything that your further discussion with Argent had changed. Is there anything in the revised version I should particularly need?
*laughs* The first attempt to use it, I was already up in a skybox at 500M, and I forgot that the coordinates were all offsets from current position. So I tried to go to the roof of the skybox, just 5 M higher at 505 M, and shot myself right out of the world! 500 + 505 being far more than the apparent 768 M limit! And since I had also entered the X and Y coordinates, and not just the offsets, I wasn't over the box when I fell back down. So I did some unintentional skydiving!
The second set of these that I installed went much more smoothly. Each of the three stops delivered me exactly on target, every time, to every location.
Three questions:
It seems to take a fair amount of time for the elevator to get from the ground at 20 M or so to a platform at 350 M to 500 M. Is there any way to make it move faster?
Is there any way to control the camera position and angle during transport and on arrival? My problem is that I step onto the pad in one corner, and I am landing at the new floor while close to a wall, but the camera ends up on the wrong side of the wall, (Outside the skybox!) It is much the same problem as using some sit scripts when your back is too close to the wall. I don't care that much if they are facing the wall on arrival, but I would like to be able to see the person when they arrive. I'm having to change to mouselook on arrival, to face the right way and step away from the wall. I also noticed that if I didn't focus my camera on the avatar prior to stepping on the pad, the camera angle might get left behind, or might follow the pad back to it's origin after dropping off the avatar. So controlling the camera would help make use consistent. If there is also a reasonable way to control which direction the avatar faces once they step on the pad, that would be useful.
Finally, is there any reason not to set this up so it uses exact coordinates for each stop, rather than an offset from current position? It's so much easier to get the coordinates of each pad, rather than calculating the relative offsets between each location. And if it used coordinates instead of offset, the same script could be used at all stops, rather than recalculated values for each stop.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
04-24-2006 12:46
Hello Ceera, From: Ceera Murakami It works fine, though I haven't tried yet to add anything that your further discussion with Argent had changed. Is there anything in the revised version I should particularly need? No, I don't think you need the last version. It was through a trial and error process to avoid the SL bugs. At present, it has been solved. From: Ceera Murakami It seems to take a fair amount of time for the elevator to get from the ground at 20 M or so to a platform at 350 M to 500 M. Is there any way to make it move faster? The original moving relys on llSetPos, so I think it is the speed limit of this method. The physical elevator used llApplyImpulse can go faster. From: Ceera Murakami Is there any way to control the camera position and angle during transport and on arrival? My problem is that I step onto the pad in one corner, and I am landing at the new floor while close to a wall, but the camera ends up on the wrong side of the wall, (Outside the skybox!) It is much the same problem as using some sit scripts when your back is too close to the wall. I don't care that much if they are facing the wall on arrival, but I would like to be able to see the person when they arrive. I'm having to change to mouselook on arrival, to face the right way and step away from the wall. I also noticed that if I didn't focus my camera on the avatar prior to stepping on the pad, the camera angle might get left behind, or might follow the pad back to it's origin after dropping off the avatar. So controlling the camera would help make use consistent. If there is also a reasonable way to control which direction the avatar faces once they step on the pad, that would be useful. hmm... camera control.... I didn't think it at all. I'll try it. From: Ceera Murakami Finally, is there any reason not to set this up so it uses exact coordinates for each stop, rather than an offset from current position? It's so much easier to get the coordinates of each pad, rather than calculating the relative offsets between each location. And if it used coordinates instead of offset, the same script could be used at all stops, rather than recalculated values for each stop. Yeah, I know someone who knows much about coordinates is unhappy with that way. But consider what most ppl will do with this script first. I guess they will try to put this script into a prim. I don't know, however, that they live and stand on how height level of the land. If I set the height as the ablolute value, it might go under ground.  But as someone mentioned in the begining of this thread, you can change it to exact coordinates. I'm developing the next version of this elevator. It is supposed to be easer to cooridnate because it is set by the absolute value and users don't have to think it at all, just copying the infomations to a notecard. One elevator floor moves and never turns back automatically. Calling method is used llRemoteLoadScriptPin. It almost worked out. But the speed issue is unsolved. I try to change it to be phiscal in midstream but don't expect it so much. 
_____________________
 Seagel Neville 
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
04-24-2006 14:41
One thing you could do is what I've done with the modified inner t00bs I've developed for floating on prim water (you can see them and some should be set for sale on the Coonspiracy land in the south-west of Raccoon Valley, or in the swamp near the Coonspiracy Store) -- they llSensor() for tagged prims that tell them where the water surface is supposed to be (they can't sense the water itself because they need to know the surface, not the center). You would have "floor prims" set to guide the elevator. Have it llSensor() for prims named "Floor 2" and so on... if it doesn't see one, look for "Floor 1" or "Floor 3" to see if it needs to go up or down from where it is...
|
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
|
very simple elevator code
04-24-2006 20:03
This is a very simplified elevator. I just put a couple of boxes on a slab and this code in the slab. It does not check for going underground, you probably lose it if you did, but you could easily add code to fix that. Isn't the return button on your land wonderful? it can be operated by whoever clicks on it. Clicking on it also regenerates the start point. There is usually a copy on my land at euttum 148, 140 which carries me to my houses, one 50 M up, the other 200M up. If you use it would you please put it back? Thanks. I use it as a rough builder's platform to rez the first prim at any height. Feel free to use this in any way you like. integer gChannel = 10; vector gPos; key gOpKey; string miUp = "Up"; string miDn = "Down"; string miUp10 = "Up 10"; string miDn10 = "Down 10"; string miUp50 = "Up 50"; string miDn50 = "Down 50"; string miE = "East"; string miW = "West"; string miN = "North"; string miS = "South";
// vector to string string v2s (vector v) { string s1 = f2s (v.x, 0); string s2 = f2s (v.y, 0); string s3 = f2s (v.z, 1); return "(" + s1 + "," + s2 + "," + s3 + ")"; }
// float to string
string f2s (float f, integer n) { integer m = n; integer div = 1; while (m > 0) { div *= 10; f *= 10.0; --m; } integer i = llRound (f); string lhs = (string) (i / div); string rhs = (string) (i % div); string ans; if (n > 0) ans = lhs + "." + rhs; else ans = lhs; return ans; }
string getDialogPrompt () { string mes = ""; float ground = llGround (<0,0,0>); float height = gPos.z - ground; mes = "height = " + f2s (height, 1) + "M, Pos = " + v2s (gPos); return mes; }
goN () { //llOwnerSay (miDn); vector newPos = <gPos.x, gPos.y + 1.0, gPos.z>; llSetPos (newPos); gPos = newPos; }
goS () { //llOwnerSay (miDn); vector newPos = <gPos.x, gPos.y - 1.0, gPos.z>; llSetPos (newPos); gPos = newPos; }
goE () { //llOwnerSay (miDn); vector newPos = <gPos.x + 1.0, gPos.y, gPos.z>; llSetPos (newPos); gPos = newPos; }
goW () { //llOwnerSay (miDn); vector newPos = <gPos.x - 1.0, gPos.y, gPos.z>; llSetPos (newPos); gPos = newPos; }
goDn () { //llOwnerSay (miDn); vector newPos = <gPos.x, gPos.y, gPos.z - 1.0>; llSetPos (newPos); gPos = newPos; }
goDn10 () { //llOwnerSay (miDn10); integer i; for (i = 0; i < 10; i++) goDn (); }
goDn50 () { //llOwnerSay (miDn10); integer i; for (i = 0; i < 50; i++) goDn (); }
goUp () { //llOwnerSay (miUp10); vector newPos = <gPos.x, gPos.y, gPos.z + 1.0>; llSetPos (newPos); gPos = newPos; }
goUp10 () { //llOwnerSay (miUp10); integer i; for (i = 0; i < 10; i++) goUp (); }
goUp50 () { //llOwnerSay (miUp10); integer i; for (i = 0; i < 50; i++) goUp (); }
list menuListMove = [miDn, miDn10, miDn50, miUp, miUp10, miUp50, miE, miW, miN, miS]; setDialog () { llDialog (gOpKey, getDialogPrompt (), menuListMove, gChannel); }
actionDialogCommand (string message) { if (message == miUp) {goUp (); return;} if (message == miDn) {goDn (); return;} if (message == miUp10) {goUp10 (); return;} if (message == miDn10) {goDn10 (); return;} if (message == miUp50) {goUp50 (); return;} if (message == miDn50) {goDn50 (); return;} if (message == miN) {goN (); return;} if (message == miS) {goS (); return;} if (message == miE) {goE (); return;} if (message == miW) {goW (); return;} }
default { on_rez (integer x) { // llResetScript (); llSetText ("Touch me for menu when not moving", <1.0,1.0,1.0>, 1.0); }
state_entry() { // gOwnerKey = llGetOwner(); // llOwnerSay("Simple Elevator starting at " + v2s (gPos)); }
listen( integer rchannel, string name, key id, string message ) { // llOwnerSay ("name=" + name + " message=" + message); actionDialogCommand (message); setDialog (); }
touch_start(integer total_number) { // llResetScript (); key op = llDetectedKey(0); if (op != NULL_KEY) { gOpKey = op; llListen( gChannel, "", "", "" ); gPos = llGetPos (); setDialog (); } else llOwnerSay ("detected null key in touch start"); } }
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
04-24-2006 22:21
Hi ed44, thank you for showing us your code. I like your vehicle-like elevator. From: ed44 Gupte It does not check for going underground, you probably lose it if you did, but you could easily add code to fix that. Isn't the return button on your land wonderful? Yeah, it was possible if it would be within the voice range.
_____________________
 Seagel Neville 
|
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
|
Not showing below ground
04-24-2006 23:39
Hi Seagel
Just tried putting it underground (got plenty spare prims att) but it stayed visible above aground (well, half in the ground).
Went down to -15 M and it still stayed visible! The ground height display on the hud is the difference between llGround and the z value from llGetPos calls.
The other weird thing is that the ground actually shows a dip down to 93 at that point that i am sure was not there before. The ground behaves in mysterious ways! That maybe only happens on one's own land because of land manipulation permissions. Not sure what happens if i do this on another's land.
Addendum, even weirder, just took it other neighbour's land who is 5 M higher than mine and the slab showed at his/her ground level, while the hud showed -5 M wrt ground. When I moved it back it just lowered itself back to show at the correct position. So the llGetPos, llSetPos, and llGround functions are all working correctly, it is simply not displaying it correctly (ie, not disappearing below the ground).
At least I now know my f2s function has a problem with negative floats.
Ed
|
Socks Sleestak
Registered User
Join date: 26 Mar 2006
Posts: 3
|
Auto unsit passengers as well?
05-10-2006 15:03
So, I've installed this script, works great. I even added some owner checks and other stuff for fun, but am wondering about adding additional poseballs for passengers. I have one now, and cranked up the delay before return. That seems to work ok, but is there any way to detect all linked poseballs and unsit those users as well?
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
05-10-2006 15:21
What about adding llMessageLinked in ElevatorMove functionn? And when your each Poseball listens to it, fire llUnSit. ElevatorMove() { if(FloorSelection) { vector TargetPos = <StartPos.x, StartPos.y, StartPos.z + height>; while(llVecDist(llGetPos(), TargetPos) != 0) { llSetPos(TargetPos); } llUnSit(av); llMessageLinked(LINK_SET, 0, "Get off", ""); llSleep(1); while(llVecDist(llGetPos(), StartPos) != 0) { llSetPos(StartPos); } } else { llUnSit(av); llWhisper(0, "Plz touch this floor and select where you go first"); } }
_____________________
 Seagel Neville 
|
wholesale Bing
Registered User
Join date: 27 Jun 2007
Posts: 24
|
great lift !!! but ....
08-27-2007 13:24
// anyway to get the hud to pop up , when u stand on the platform ,so u don't have to click , dumb newbie who can,t script many thanx From: Seagel Neville Hello there, Though I didn't think of normal use, if you want to use this within short range and move slower, this is an adjustable speed version. // SN_Elevator(adjustable speed version) was made by Seagel Neville as public domain, Dec 2005.
list heightList = [10, 20, 30]; // You have to put down the height of each floor here list menuList = ["2F", "3F", "4F"]; // Dialog box's list. Go along with heightList. integer speed = 10; // You can change the elevator speed here. 1 is the fastest.
key av; float height; integer CHANNEL; integer HANDLE; integer FloorSelection = FALSE; vector StartPos; vector AVsize;
StopSitAnim() // Don't sit on the floor. ;p { llStopAnimation("sit_generic"); llStopAnimation("sit"); llStartAnimation("impatient"); // Needed keyframes of legs. } // If you want to know this more, make sure to replace this for "stand". ;p
ElevatorMove() { if(FloorSelection) { integer i; for(i = 0; i <= speed; i++) { llSetPos(llGetPos() + (<0.0, 0.0, height / speed> * llGetRot())); } llUnSit(av); llSleep(1); while(llVecDist(llGetPos(), StartPos) != 0) { llSetPos(StartPos); } } else { llUnSit(av); llWhisper(0, "Plz touch this floor and select where you go first"); } }
default { state_entry() { llSetSitText("Get on"); StartPos = llGetPos(); } on_rez(integer start_param) { llResetScript(); } changed(integer change) { if(change & CHANGED_LINK) { av = llAvatarOnSitTarget(); if(av != NULL_KEY) { llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION); } } } run_time_permissions(integer perm) { StopSitAnim(); ElevatorMove(); FloorSelection = FALSE; } touch_start(integer change) { key av = llDetectedKey(0); AVsize = llGetAgentSize(av); llSitTarget(<0, 0, (AVsize.z / 2)>, ZERO_ROTATION); // Wow, don't you think this is a master touch? ;p integer CHANNEL = llRound(llFrand(1000000) - 10000000); HANDLE = llListen(CHANNEL, "", "", ""); llDialog(av, "To what floor do you go?", menuList, CHANNEL); } listen(integer channel, string name, key id, string message) { height = llList2Float(heightList, llListFindList(menuList, [message])); llListenRemove(HANDLE); // Is this a manner? FloorSelection = TRUE; } } [EDIT] Note:If you let it go heigher, you seem to have to increase the value of speed, that is, to make it slower. I'm not sure why but I experienced that I could go up just 20m when I set the speed 1. And heiger you go, more inaccurate the actual height is... Yeah, I know why this happens. 
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
08-27-2007 15:49
From: wholesale Bing // anyway to get the hud to pop up , when u stand on the platform ,so u don't have to click , dumb newbie who can,t script many thanx It couldn't help but have you touch it before sitting to measure height of your avaar so that you stood up proper position. If you don't like that, do the followings. [EDIT]hmm... Sorry, I should have changed the construction much more to do that. Wait... now I can't do it. I'll write it later...[/EDIT] Oops, I've just found that I decleard "av" double... I have to fix it... 
_____________________
 Seagel Neville 
|
Seagel Neville
Far East User
Join date: 2 Jan 2005
Posts: 1,476
|
08-27-2007 20:09
Well, what about this? I've not tested this though. // No touch version, Aug 2007 // SN_Elevator was made by Seagel Neville as public domain, Dec 2005.
list heightList = [300, 500, 700]; // You have to put down the height of each floor here list menuList = ["2F", "3F", "Rooftop"]; // Dialog box's list. Go along with heightList.
key av; float height; integer CHANNEL; integer HANDLE; vector StartPos;
StopSitAnim() // Don't sit on the floor. { llStopAnimation("sit_generic"); llStopAnimation("sit"); llStartAnimation("impatient"); // Needed keyframes of legs' parts. } // If you want to know this more, make sure to replace this for "stand".
ElevatorMove() { vector TargetPos = <StartPos.x, StartPos.y, StartPos.z + height>; while(llVecDist(llGetPos(), TargetPos) != 0) { llSetPos(TargetPos); } llUnSit(av); llSleep(1); while(llVecDist(llGetPos(), StartPos) != 0) { llSetPos(StartPos); } }
default { state_entry() { llSetSitText("Get on"); StartPos = llGetPos(); llSitTarget(<0, 0, 1.0>, ZERO_ROTATION); } on_rez(integer start_param) { llResetScript(); } changed(integer change) { if(change & CHANGED_LINK) { av = llAvatarOnSitTarget(); if(av != NULL_KEY) { llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION); } } } run_time_permissions(integer perm) { StopSitAnim(); CHANNEL = llRound(llFrand(1000000) - 10000000); HANDLE = llListen(CHANNEL, "", "", ""); llDialog(av, "To what floor do you go?", menuList, CHANNEL); } listen(integer channel, string name, key id, string message) { height = llList2Float(heightList, llListFindList(menuList, [message])); llListenRemove(HANDLE); // Is this a manner? ElevatorMove(); } }
_____________________
 Seagel Neville 
|
wholesale Bing
Registered User
Join date: 27 Jun 2007
Posts: 24
|
yep works thanx
08-28-2007 04:24
yep thats works well ,thank you ,now all i need to do is have a click to use sign in my lift and anyone can figure it out  great !!!!
|
Justin Slade
Registered User
Join date: 6 Feb 2007
Posts: 132
|
Thanks for making this
09-04-2007 14:16
I was wondering if you could give me target pos different the start pos Looking to build a highrise the will have a elevator with a slightly slope as it goes up and back down. Is it possible with this script? Thanks Justin
|