Tubaman Grasshopper
Registered User
Join date: 27 Apr 2005
Posts: 18
|
07-06-2005 19:19
I searched, but didn't find the flight belt that I thought I saw mentioned on here once. Haven't I seen an a super duper nifty flying script on here that lets you go real high, real fast, hover, etc. ?
|
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
|
07-07-2005 09:27
Im me in-world. I have a custom script that works along the lines of Carbon Rod and the like, but with half the calories, and all the flavor!
|
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
|
07-07-2005 11:19
//ZeroFlight XLR8 //hacked together script by Burke Prefect, peices from other people's code. //NOT RESPONSIBLE... FOR ANYTHING float speed = 15; // this is starting speed. vector mode_color = <.5,.5,.5>; // default display color for HUD.
set_hover() // this keeps you from falling at extreme altitudes. just 'fly' normally. works in either mode. { vector pos = llGetPos(); float ground = llGround(<0,0,0>); if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING) { if((pos.z > 75) && (pos.z > (ground + 35))) { llSetForce(<0,0,9.8> * llGetMass(), FALSE); llMessageLinked(LINK_SET, 0, "flyingON", NULL_KEY); } else { llSetForce(<0,0,0>, FALSE); llMessageLinked(LINK_SET, 0, "flyingON", NULL_KEY); } } else { llSetForce(<0,0,0>, FALSE); llMessageLinked(LINK_SET, 0, "flyingOFF", NULL_KEY); } }
helptext() { llWhisper(0,"To Turn ON/OFF :: click pack or say '!fly'."); llWhisper(0,"When ON :: say '!s (num)' to set speed boost factor"); llWhisper(0,"Hover function automatically engaged when avater flying at high altitude"); llWhisper(0,"To change colors, say !blue, !green, !red, !black.[end]"); }
default // this is where the script starts off. it's not active, it's just waiting for a command. { state_entry() { key id = llGetOwner(); llWhisper(0,"*Disengaged*"); llListen(0,"",id,""); llSetText("",<0,0,0>,1); llSetTimerEvent(.5); llReleaseControls(); llSetBuoyancy(0.0); llMessageLinked(LINK_SET, 0, "flyingOFF", NULL_KEY); } //on_rez(integer total_number) // this is small peice of code that resets the script. It's in both states. // {llWhisper(0,"*Ready To Activate. Say 'fly' to activate. Say 'winghelp' for more.*");} attach(key id) { llWhisper(0,"*Ready To Activate. Say '!fly' to activate. Say '!winghelp' for more.*"); llSetForce(<0,0,0>, FALSE); } touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { state freakpack; } } timer() { set_hover(); } listen(integer number, string name, key id, string m) { if (m=="!fly") { state freakpack; } if (m=="!winghelp") { helptext(); } if (m=="!red") { llMessageLinked(LINK_SET, 0, "color_red", NULL_KEY); mode_color = <1,0,0>; } if (m=="!blue") { llMessageLinked(LINK_SET, 0, "color_blue", NULL_KEY); mode_color = <0,.25,.5>; } if (m=="!green") { llMessageLinked(LINK_SET, 0, "color_green", NULL_KEY); mode_color = <0,1,0>; } if (m=="!black") { llMessageLinked(LINK_SET, 0, "color_black", NULL_KEY); mode_color = <0,0,0>; } } }
//// By making 'freakpack' it's own state, we can control it much easier. state freakpack { state_entry() { llWhisper(0,"*Engaged*"); llSetTimerEvent(.5); key id = llGetOwner(); llListen(0,"",id,""); llRequestPermissions(id,PERMISSION_TAKE_CONTROLS); } // on_rez(integer total_number) //{llResetScript();} touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { llReleaseControls(); state default; } }
timer() { set_hover(); } run_time_permissions(integer perm) { if(perm & PERMISSION_TAKE_CONTROLS) { llTakeControls(CONTROL_FWD|CONTROL_BACK|CONTROL_LEFT|CONTROL_RIGHT|CONTROL_UP|CONTROL_DOWN,TRUE,TRUE); } } control(key av, integer level, integer edge) { if(level & CONTROL_UP) { llApplyImpulse(<0,0,speed*3>,FALSE); } if(level & CONTROL_DOWN) { llApplyImpulse(<0,0,-speed*3>,FALSE); } if(level & CONTROL_LEFT) { if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING) { llApplyImpulse(<0,speed,0>,TRUE);} } if(level & CONTROL_RIGHT) { if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING) {llApplyImpulse(<0,-speed,0>,TRUE);} } if(level & CONTROL_FWD) { if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING) {llApplyImpulse(<speed,0,0>,TRUE);} } if(level & CONTROL_BACK) { if(llGetAgentInfo(llGetOwner()) & AGENT_FLYING) {llApplyImpulse(<-speed,0,0>,TRUE);} } } timer() { vector pos = llGetPos(); string vel=(string) ( (integer)(llVecMag(llGetVel()))*2); //llSetText(llGetRegionName() + " (" + (string) ( (integer)pos.x) + "," + (string) ( (integer)pos.y) + ")\nAlt: " + (string) ( (integer)pos.z) + "m" + "\n Speed: "+ vol + "mph \nBoost: " + (string) ( (integer)speed) + "x\n \n \n \n \n \n \n \n \n \n \n",<0.5,0.5,0.5>,2); llSetText("Vel: "+ vel + "mph \nAlt: " + (string) ( (integer)pos.z) + "m" + "\nBoost: " + (string) ( (integer)speed) + "x\n \n \n \n \n \n \n \n \n \n \n",mode_color,2); set_hover(); } listen(integer channel, string name, key id, string m) { string ml = llToLower(m); list parsed = llParseString2List(ml,[" "],[]); if(llList2String(parsed,0) == "!s") { speed = (float)llList2String(parsed,1); } if (m=="!fly") { state default; llReleaseControls(); } if (m=="!winghelp") { helptext(); } if (m=="!red") { llMessageLinked(LINK_SET, 0, "color_red", NULL_KEY); mode_color = <1,0,0>; } if (m=="!blue") { llMessageLinked(LINK_SET, 0, "color_blue", NULL_KEY); mode_color = <0,.25,.5>; } if (m=="!green") { llMessageLinked(LINK_SET, 0, "color_green", NULL_KEY); mode_color = <0,1,0>; } if (m=="!black") { llMessageLinked(LINK_SET, 0, "color_black", NULL_KEY); mode_color = <0,0,0>; } } }
|
Alan Kiesler
Retired Resident
Join date: 29 Jun 2004
Posts: 354
|
07-07-2005 23:25
I also have a very simple flight script in the works (written with teaching in mind, full mods, probably hand out to folks who want to use it for such - I have no time to teach myself unfortunately).
I will eventually, once its in a state I'm happy with, release the setup to script library and wiki (as I said, its designed for teaching control event and such). I can send an earlier version if you want, IM me.
_____________________
Timothy S. Kimball (RL) -- aka 'Alan Kiesler' The Kind Healer -- http://sungak.net
No ending is EVER written; Communities will continue on their own.
|
Jeff Beckenbauer
Guardian of the Universe
Join date: 23 Apr 2004
Posts: 10
|
Flight Script
08-22-2005 18:59
** cough ..** welcome to my first post all  ok - Thanks Burke for posting this - I have been playing with it today and it works great - exactly what I was after for a project I am working on - but of course - one problem. I took me a while to figgure out what was happening but when flying - suddenly the speed would drop back to normal and I would have to reset to get it to work again. It happens when I cross the border from one sim to the next, am I doing something wrong or is there a fix for this??? Thanks all in advance, and Alan I would like to see the simple script also - I might try to look you up 
|
Jef Ambassador
Empathetic Extropian
Join date: 1 May 2005
Posts: 9
|
08-22-2005 20:00
Coincidentally, I discovered the same problem last night, and have not yet resolved it, but in my case it seemed to be an interaction with a specially prepared phantom prim containing the flight script. Seems to work well for me until I try to use the flight enhancement script within a prim that had the llVolumeDetect trick used on it. Flight enhancement is immediately lost upon crossing a sim boundry, but I found one way to restore it was to drop the prim, rescale it while unattached, and then re-attach. I played with changing a few things upon a moving_start event, but still searching for a solution. - Jef
|
Xantor Welesa
Registered User
Join date: 16 Jun 2005
Posts: 18
|
08-24-2005 06:11
Because crossing a sim boundary causes the state_entry to fire, (it is handed over to an other simulator) the reset-code gets executed. Move this part of the code (which btw needs some major cleanup) to on_rez or on_attach to resolve the problem. state_entry() { key id = llGetOwner(); llWhisper(0,"*Disengaged*"  ; llListen(0,"",id,""  ; llSetText("",<0,0,0>,1); llSetTimerEvent(.5); llReleaseControls(); llSetBuoyancy(0.0); llMessageLinked(LINK_SET, 0, "flyingOFF", NULL_KEY); }
|
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
|
08-25-2005 14:41
No, that's wrong. Crossing a sim boundary does NOT cause state_entry to fire. Code to prove it: default { state_entry() { llOwnerSay("state_entry triggered"); } }
|