Jump to content

boxixiong

Resident
  • Posts

    4
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Thank you guys for the help! I was just wondering, is it possible to use scratch for second life to create a smooth rotating motion. At the moment, my script looks like this: vector home; integer penState; float penColor; float color; float ghost; vector originalScale; float sizePercent; integer numAvatarsNearby; vector nearestAvPosition; key ownerKey; vector ownerPosition; move(float steps) { vector fwd = llRot2Fwd(llGetRot()) * steps; llSetPos(llGetPos() + fwd); if (penState == TRUE) { if (llGetInventoryType("lineSegment") == INVENTORY_NONE) { llSay(0, "Oops! To draw a line, my inventory needs a lineSegment. You can get one from the Scratch Inventory Box."); } else { integer randomID = llRound(llFrand(99999999)); llRezObject("lineSegment", llGetPos()-fwd/2, <0,0,0>, llGetRot(), randomID); llSay(1, (string)randomID + ":set length:"+ (string)llFabs(steps)); llSay(1, (string)randomID + ":set color:" + (string)penColor); } } } turnRight(float angle) { angle *= -1; rotation newRot = llEuler2Rot(<0,0,angle> * DEG_TO_RAD); llSetRot(newRot*llGetRot()); } turnLeft(float angle) { rotation newRot = llEuler2Rot(<0,0,angle> * DEG_TO_RAD); llSetRot(newRot*llGetRot()); } up(float steps) { llSetPos(llGetPos()+<0,0,steps>); } down(float steps) { llSetPos(llGetPos()+<0,0,-1*steps>); } turnPitch(float angle) { angle *= -1; rotation newRot = llEuler2Rot(<0,angle,0> * DEG_TO_RAD); llSetRot(newRot*llGetRot()); } float getHeading() { return llRot2Angle(llGetRot())*RAD_TO_DEG; } setHeading(float angle) { vector newVec = <0, 0, angle*DEG_TO_RAD>; rotation newRot = llEuler2Rot(newVec); llSetRot(newRot); } turnRoll(float angle) { rotation newRot = llEuler2Rot(<angle,0,0> * DEG_TO_RAD); llSetRot(newRot*llGetRot()); } changePenColorBy(float num) { penColor += num; setPenColorTo(penColor); } setPenColorTo(float num) { penColor = (integer)num % 100; } penDown() { penState = TRUE; } penUp() { penState = FALSE; } clear() { llSay(1, "clearLineSegments"); } pointTowardNearestAv() { vector myPos = llGetPos(); float xdiff = myPos.x - nearestAvPosition.x; float ydiff = myPos.y - nearestAvPosition.y; float angle = llAtan2(xdiff, ydiff) * RAD_TO_DEG; setHeading(270 - angle); } pointTowardOwner() { vector myPos = llGetPos(); float xdiff = myPos.x - ownerPosition.x; float ydiff = myPos.y - ownerPosition.y; float angle = llAtan2(xdiff, ydiff) * RAD_TO_DEG; setHeading(270 - angle); } float distanceToNearestAv() { return llVecDist(llGetPos(), nearestAvPosition); } float distanceToOwner() { return llVecDist(llGetPos(), ownerPosition); } integer randomMinToMax(float min, float max) { return llRound(llFrand(max - min) + min); } say(string text) { llSay(0, text); } broadcast(string message) { llSay(1, message); } setText(string text) { llSetText(text, <1,1,1>, 1); } vector hueToRGB(float h) { integer i; float f; float p; float q; float t; float r; float g; float b; float s = 1; float v = 1; h *= 5; i = llFloor(h); f = h - i; p = v * ( 1 - s ); q = v * ( 1 - s * f ); t = v * ( 1 - s * ( 1 - f ) ); if (i == 0) { r = v; g = t; b = p; } else if (i == 1) { r = q; g = v; b = p; } else if (i == 2) { r = p; g = v; b = t; } else if (i == 3) { r = p; g = q; b = v; } else if (i == 4) { r = t; g = p; b = v; } else { r = v; g = p; b = q; } return <r,g,b>; } setColor(float num) { color = (integer)num % 100; llSetColor(hueToRGB(color / 100), ALL_SIDES); if (llGetObjectName() == "Scratch Bug") { llSetLinkColor(2, hueToRGB(color / 100), ALL_SIDES); } else { } } changeColorBy(float num) { float newColor = color + num; if (newColor < 0) { newColor = 0; } if (newColor > 100) { newColor = 100; } setColor(newColor); } setGhost(float num) { ghost = (integer)num % 101; llSetAlpha(((100 - ghost) / 100), ALL_SIDES); llSetLinkAlpha(LINK_SET, ((100 - ghost) / 100), ALL_SIDES); } changeGhostBy(float num) { setGhost(ghost + num); } setSize(float newSize) { sizePercent = newSize; vector newScale = originalScale*(sizePercent/100); llSetScale(newScale); } changeSizeBy(float change) { sizePercent += change; vector newScale = originalScale*(sizePercent/100); llSetScale(newScale); } playSound(string snd) { llPlaySound(snd, 1); } playSoundNamed(string snd) { if (llGetInventoryType(snd) == INVENTORY_NONE) { llSay(0, "Oops! My inventory does not contain the sound " + snd); } else { llPlaySound(snd, 1); } } wait(float secs) { llSleep(secs); } levelOut() { vector myVec = llRot2Euler(llGetRot()); vector newVec = <0, 0, myVec.z>; rotation newRot = llEuler2Rot(newVec); llSetRot(newRot); } goHome() { llSetPos(home); } setHomeHere() { home = llGetPos(); } startListening() { llListen(0, "", "", ""); llListen(1, "", "", ""); } initInternal() { setHomeHere(); penState = FALSE; penColor = 0; color = 0; ghost = 0; sizePercent = 100; originalScale = llGetScale(); ownerKey = llGetOwner(); llSetText("", <1,1,1>, 0); llSensorRepeat("", "", AGENT, 96, PI, .1); llSetTimerEvent(.1); startListening(); } initAll() { initInternal(); } touch1(){ integer i1; for (i1=0; i1<10;i1++) { turnRoll(5); wait(0.1); } } default { state_entry() { initAll(); } on_rez(integer start_param) { initAll(); } sensor(integer n) { numAvatarsNearby = n; nearestAvPosition = llDetectedPos(0); integer i; for (i=0; i<n; i++) { if (llDetectedKey(i) == ownerKey) { ownerPosition = llDetectedPos(i); } } } touch_start(integer n) { touch1(); } collision_start(integer n) { } listen(integer channel, string name, key id, string msg) { } timer() { } } Is there anyway to alter this so that the rotating motion is a lot smoother. e.g. make it rotate a certain angle in a certain amount of time. I am noob at scripting so i need to use scratch for second life lol Thanks for the help
  2. Hi all, I was just wondering if there is anyway to script so that a object centre of rotation is from the end of a prim instead of from the centre. I am using scratch for second life at the moment and all it allows me to do is make a object rotate using the centre of the object as the centre of rotation I figured there must be a easy way to do this so please help :) The object also needs to rotate to a certain angle and at a certain speed. Any help is appreciated. Thank you! :D
  3. Hi all, I am looking for a scriptor to script a boat i have created. The boat at the moment is just a few prims put together. I would like the boat to move from point A to point B when someone sits on it and then when it arrives at the destination pauses until the person gets out. I would then like the boat to move back from point B to point A to pick up another passenger. If possible, I also would like the the building at point B to light up when the boat arrives. Any help is appreciated Thank you
  4. Hi all, I have just created a boat out of several prims for a school assignment. I was just wondering if someone could help me/ give me a script to make my boat move from point A to B when sat on then pause at point B for a set amount of time then return from point B to point A to pick up passengers again. I am a complete noob at scripting so please explain the script in detail Thank you guys so much :)
×
×
  • Create New...