/ Forside/ Teknologi / Operativsystemer / MS Windows / Spørgsmål
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
MS Windows
#NavnPoint
Klaudi 76474
o.v.n. 67550
refi 58409
tedd 45557
Manse9933 45149
molokyle 40687
miritdk 38357
briani 27239
BjarneD 26414
10  pallebhan.. 24310
Hey you>MOLOKYLE
Fra : Manse9933
Vist : 446 gange
100 point
Dato : 09-03-07 11:30

Tak for hjælpen>
http://www.kandu.dk/QuestionHist.aspx?qid=101597

Du må nok anskaffe dig noget hardware der kan følge med,
vis du ikke vil efterlades i de store drenge bagjulog
ende som en IT analfabet

Manse9933

 
 
Kommentar
Fra : Manse9933


Dato : 09-03-07 11:31

s

Accepteret svar
Fra : molokyle

Modtaget 110 point
Dato : 09-03-07 11:36

Faktisk lå det accepterede link ..lige for næsen af dig i mit 5.) link

Der finder du nemlig også en newbie lektion i Linden scripting:

http://wiki.secondlife.com/wiki/LSL_Portal

Det'Let at lære

Sådan loaver du en 'floater':
Kode
float LINEAR_TAU = 0.75;
float TARGET_INCREMENT = 0.5;
float ANGULAR_TAU = 1.5;
float ANGULAR_DAMPING = 0.85;
float THETA_INCREMENT = 10;// 0.3
integer LEVELS = 0;
vector pos;
vector face;
float brake = 0.5;
key gOwnerKey;
string gOwnerName;
key gToucher;
key Driver;
string Name1 = "Illume Skallagrimson";
string Name2 = "Chimera Lily";
string gFLYING = "FALSE";
string sound="power";
key id;
integer nudge = FALSE;
vector POSITION;
integer auto=FALSE;

help()
{
llWhisper(0,"Commands:");
llWhisper(0,"Left click craft = Start ");
llWhisper(0,"Left click craft = Stop and release contol");
llWhisper(0,"1! through 9!, slow or warp = Set power");
llWhisper(0,"view! = Align view to craft");
llWhisper(0,"menu = Display options");
llWhisper(0,"PgUp or PgDn = Gain or lose altitude");
llWhisper(0,"Arrow keys = Left, right, forwards and back");
llWhisper(0,"Shift + arrow Left, Right = Rotate but maintain view");
llWhisper(0,"PgUp + PgDn = Set cruise on or off");
}

default
{
state_entry()
{

gOwnerKey = llGetOwner();
gOwnerName = llKey2Name(llGetOwner());
llSoundPreload(sound);
llStopSound();
llSetTimerEvent(0.0);
llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", id);
llSetStatus(STATUS_PHYSICS, FALSE);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, TRUE);
llSleep(0.1);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);
llSetStatus(STATUS_PHYSICS, TRUE);
llMoveToTarget(llGetPos(), 0);
llRotLookAt(llGetRot(), 0, 0);
llSetStatus(STATUS_PHYSICS, FALSE);
LEVELS = CONTROL_FWD | CONTROL_BACK | CONTROL_ROT_LEFT | CONTROL_ROT_RIGHT | CONTROL_UP | CONTROL_DOWN | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ML_LBUTTON;

TARGET_INCREMENT = 0.5;
//llSitTarget(<-0.8, 0.0, 1.0>, ZERO_ROTATION);
llSitTarget(<0.3, 0.0, 0.50>, ZERO_ROTATION); // good for default cube.
llSetCameraEyeOffset(<-10.0, 1.0, 3.0>);
llSetSitText("Get in");
llSetCameraAtOffset(<0, 1.0, 0>);
llWhisper(0,"By your command ... click again to engage. Type menu for options.");

// this sets a Listen with no callback in this state...
llListen(0, "", "", "");

state Listening;
}

}

state Listening
{
// Here we set up the Listen that is used in the Listening state...
state_entry()
{
llListen(0, "", "", "");
}

// the rest was here before...
// This is the click callback
touch_start(integer total_number)
{
if (llSameGroup(llDetectedKey(total_number - 1))==1 || llDetectedName(total_number - 1)==Name1 || llDetectedName(total_number - 1)==Name2)
{
if (gFLYING == "FALSE")
{
gFLYING = "TRUE";
llSetStatus(STATUS_PHYSICS, TRUE);
Driver=llDetectedKey(total_number - 1);
state StateDriving;
}
}
else
{
llWhisper(0,"You must own or belong to this group to fly craft");
llInstantMessage(gOwnerKey,llDetectedName(total_number - 1) + " is touching your craft");
}
}

// Here is the Listen callback
listen(integer chan, string name, key id, string msg)
{
if (llSameGroup(id)==1)
{
if (llToLower(msg) == "menu")
{
help();
}
}
}

// and this is an on-rez callback
on_rez(integer start_param)
{
llResetScript();
}
}

state StateDriving
{
state_entry()
{
llWhisper(0, "All systems go !!");
llRequestPermissions(Driver, PERMISSION_TAKE_CONTROLS);
llMoveToTarget(llGetPos(), LINEAR_TAU);
llRotLookAt(llGetRot(), ANGULAR_TAU, 1.0);

// Added listen here as well.... for same reason...
llListen(0, "", "", "");
}

touch_start(integer total_number)
{
if (llDetectedKey(total_number - 1)==Driver)
{
llWhisper(0,"Controls back to you");
gFLYING = "FALSE";
auto=FALSE;
llSleep(1.5);
llSetStatus(STATUS_PHYSICS, FALSE);
llMessageLinked(LINK_ALL_CHILDREN, 0, "stop", id);
llSetTimerEvent(0.0);
llReleaseControls();
llResetScript();
}
}

listen(integer chan, string name, key id, string msg)
{
if (id==Driver)
{
if (llToLower(msg) == "view!")
{
llReleaseControls();
llRequestPermissions(Driver, PERMISSION_TAKE_CONTROLS);
}
if (llToLower(msg) == "menu")
{
help();
}
if (llToLower(msg) == "warp")
{
TARGET_INCREMENT = 10.0;
string TIspew = (string)TARGET_INCREMENT;
TIspew = llGetSubString(TIspew,0,3);
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "slow")
{
TARGET_INCREMENT = 0.5;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "1!")
{
TARGET_INCREMENT = 0.75;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "2!")
{
TARGET_INCREMENT = 1.0;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "3!")
{
TARGET_INCREMENT = 1.5;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "4!")
{
TARGET_INCREMENT = 2.0;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "5!")
{
TARGET_INCREMENT = 3.0;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "6!")
{
TARGET_INCREMENT = 4.0;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "7!")
{
TARGET_INCREMENT = 5.0;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "8!")
{
TARGET_INCREMENT = 6.0;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
if (llToLower(msg) == "9!")
{
TARGET_INCREMENT = 7.0;
llWhisper(0,"Power: " + llGetSubString((string)TARGET_INCREMENT,0,3));
}
}
}

run_time_permissions(integer perm)
{
if (perm == PERMISSION_TAKE_CONTROLS)
{
llMessageLinked(LINK_ALL_CHILDREN, 0, "slow", id);
llPlaySound(sound,0.3);
llTakeControls(LEVELS, TRUE, FALSE);

}
else
{
llWhisper(0,"Stopped");
llSetTimerEvent(0.0);
gFLYING = "FALSE";
llSleep(1.5);
llResetScript();
}
}
control(key driver, integer levels, integer edges)
{
pos *= brake;
face.x *= brake;
face.z *= brake;
nudge = FALSE;
llMessageLinked(LINK_ALL_CHILDREN, 0, "slow", id);
if (levels & CONTROL_FWD)
{
if (pos.x < 0) { pos.x=0; }
else { pos.x += TARGET_INCREMENT; }
nudge = TRUE;
}
if (levels & CONTROL_BACK)
{
if (pos.x > 0) { pos.x=0; }
else { pos.x -= TARGET_INCREMENT; }
nudge = TRUE;
}
if (levels & CONTROL_UP)
{
llMessageLinked(LINK_ALL_CHILDREN, 0, "fast", id);
llPlaySound(sound,0.3);
if(pos.z<0) { pos.z=0; }
else { pos.z += TARGET_INCREMENT; }
face.x=0;
nudge = TRUE;
}
if (levels & CONTROL_DOWN)
{
llMessageLinked(LINK_ALL_CHILDREN, 0, "fast", id);
llPlaySound(sound,0.2);
if(pos.z>0) { pos.z=0; }
else { pos.z -= TARGET_INCREMENT; }
face.x=0;
nudge = TRUE;
}
if ((levels) & (CONTROL_LEFT|CONTROL_ROT_LEFT))
{
if (face.z < 0) { face.z=0; }
else { face.z += THETA_INCREMENT; }
nudge = TRUE;
}
if ((levels) & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
{
if (face.z > 0) { face.z=0; }
else { face.z -= THETA_INCREMENT; }
nudge = TRUE;
}
if ((levels & CONTROL_UP) && (levels & CONTROL_DOWN))
{
if (auto)
{
auto=FALSE;
llWhisper(0,"Cruise off");
llSetTimerEvent(0.0);
}
else
{
auto=TRUE;
llWhisper(0,"Cruise on");
llSetTimerEvent(0.5);
}
llSleep(0.5);
}

if (nudge)
{
vector world_target = pos * llGetRot();
llMoveToTarget(llGetPos() + world_target, LINEAR_TAU);

vector eul = face;
eul *= DEG_TO_RAD;
rotation quat = llEuler2Rot( eul );
rotation rot = quat * llGetRot();
llRotLookAt(rot, ANGULAR_TAU, ANGULAR_DAMPING);
}
}

timer()
{
pos *= brake;
if (pos.x < 0) { pos.x=0; }
else { pos.x += TARGET_INCREMENT; }
vector world_target = pos * llGetRot();
llMoveToTarget(llGetPos() + world_target, LINEAR_TAU);
}

}


</MOLOKYLE>

Ps.


Godkendelse af svar
Fra : Manse9933


Dato : 09-03-07 11:43

Det er enormt let molokyle,det har jeg leget med i flere år,so no problemos.

Manse9933

Kommentar
Fra : molokyle


Dato : 09-03-07 11:46

Jamen, hvorfor skriver du så ikke bare dine egne genvejstaster?

...nå men, jeg må jeg hellere takke for påængårnø

Happy coding....

</MOLOKYLE>

Du har følgende muligheder
Eftersom du ikke er logget ind i systemet, kan du ikke skrive et indlæg til dette spørgsmål.

Hvis du ikke allerede er registreret, kan du gratis blive medlem, ved at trykke på "Bliv medlem" ude i menuen.
Søg
Reklame
Statistik
Spørgsmål : 177551
Tips : 31968
Nyheder : 719565
Indlæg : 6408825
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste