Jump to content

how to mix 2 scripts?


sulie48
 Share

You are about to reply to a thread that has been inactive for 3810 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

hello,

I have 2 scripts. one is to move an object horizentaly and the other one is to elvetor an object verticaly.

bellow are the scripts for these functions. I need to combine these two scripts to gather. the way, I move the object in to the position and then elevate it up.

Thanks for your help:

// how to move an object horizantaly (on the ground)

// Script start here:
 
default
{
    state_entry() // This example uses "state_entry", so the item moves as soon as it is rezzed.
                  // This could be another event such as "touch_start" when it will move only if
                  // Or use "on_rez" and the item will move only if rezzed, and now directly when
                  // the script is compiled.
    {
        llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE); // This must be used
// with physics (we move the item, and phantom, it's not needed, but better if the object
// doesn't collide with anything. Also, it's physics, so be careful, only 32 prims
// for an item allowed.
        llMoveToTarget(<53.654,199.364,502.542>, 10); // This will move the item to the
// vector <X,Y,Z> locally on the current sim. "10" is the speed, so the  
// object will move slowly.
    }
}

===========================================================================================================

here is the object elevation scripts:

integer x;
default
{
    state_entry()
    {
        }

    touch_start(integer total_number)
    {if (x == 0)
        {vector v = llGetLocalPos();
        llSetPos (<v.x , v.y, (v.z + 5)>);
        x = 5;
llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE);
llMoveToTarget(<53.654,199.364,502.542>, 10);
        return;}
        if (x == 5)
        {vector v = llGetLocalPos();
        llSetPos (<v.x , v.y, (v.z - 5)>);
        x=0;
        return;
        }
        }
        }

Link to comment
Share on other sites

Do not strip the headers from scripts like that. It is very disrespectful to the programmer that did the work to begin with.

 

// script created by SpiritWolf Chikuwa//// /!\ PUBLIC DOMAIN /!\// You can Copy/Mod/Trans // Please, do not resell this script and give it full perm// Just please leave this header intact//// Minor changes: // (insert your name here and delete this comment if you do any mod of this script, thank you)//// Script start here: default{    state_entry() // This example uses "state_entry", so the item moves as soon as it is rezzed.                   // This could be another event such as "touch_start" when it will move only if                   // Or use "on_rez" and the item will move only if rezzed, and now directly when                  // the script is compiled.    {        llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE); // This must be used // with physics (we move the item, and phantom, it's not needed, but better if the object // doesn't collide with anything. Also, it's physics, so be careful, only 32 prims // for an item allowed.        llMoveToTarget(<53.654,199.364,502.542>, 10); // This will move the item to the // vector <X,Y,Z> locally on the current sim. "10" is the speed, so the  // object will move slowly.    }}

 This article uses content from the Second Life® Wiki article at https://wiki.secondlife.com/wiki/Move_to_target.

Copyright © 2007-2014 Linden Research, Inc. Licensed under the Creative Commons Attribution-Share Alike 3.0 License (see the complete license terms here- http://creativecommons.org/licenses/by-sa/3.0/legalcode).

  • Like 1
Link to comment
Share on other sites

it would look something like this....

 

integer x;vector v = <53.654,199.364,502.542>; default{       state_entry()    {  llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE);
llSetRegionPos(v); } on_rez(integer param) { llResetScript(); } touch_start(integer total_number) { if (x = ~x) { v.z += 5.0; llMoveToTarget(v, 1.0); llSetStatus(STATUS_PHYSICS , TRUE); llSleep(1.0); llSetStatus(STATUS_PHYSICS ,FALSE); } else { v.z -= 5.0; llMoveToTarget(v, 1.0); llSetStatus(STATUS_PHYSICS , TRUE); llSleep(1.0); llSetStatus(STATUS_PHYSICS,FALSE); } }}

 

Link to comment
Share on other sites

Hello,

I am an Engineer who tries to build up robots project I have in Real Life. I would like to use SL for my project presentation.  To do this I have no problem to learn scripting but I want to focus in the area I need to learn.

the scripting area I need to learn are:

multi axes robot movements: x, y and z. I need to learn how to move part of robot one at the time or all at the same time.

Move robot to follow the certain path.

How to loop the script to do the same function over and over.

I am really appreciated , if you can help me to find a book, software application or website to learn scripting for above functionality.

Thanks

Link to comment
Share on other sites

Tutorials for learning LSL are at http://wiki.secondlife.com/wiki/LSL_Tutorial

You'll find that LSL is a fairly straightforward language, similar to C++ and other languages that you have probably used as an engineer.  I suspect that once you've spent an evening with the tutorials and poked around in the LSL wiki to look at examples, you'll know enough to get started on your project.  As with most basic subjects, though, it doesn't make sense to just focus on learning the parts that you need today.  You certainly wouldn't advise an engineering student to start designing bridge tresses without taking at least a few basic courses in mechanics.  :smileywink:

Once you have made some progress on a script, feel free to bring it here for help over the rough spots.

Link to comment
Share on other sites

By the way, in my research I have seen some software design the movements of the avatars. Is there any software I can use to upload my AutoCAD drawing and then design the movements?

If my job was requires to design animation I didn't mind to learn fully scripting, I am trying to find the faster way to build my presentation. 

 

Link to comment
Share on other sites


sulie48 wrote:

By the way, in my research I have seen some software design the movements of the avatars. Is there any software I can use to upload my AutoCAD drawing and then design the movements?

If my job was requires to design animation I didn't mind to learn fully scripting, I am trying to find the faster way to build my presentation. 

 

What you're trying to do is prim animation and is referred to generally as "puppeteering". The title of these scripts will usually have the word "puppet" within it and a Google search for "SL puppet scripts" will bring them up for you.

 

Within them you'll find a number of approaches ranging from recording the manually set position/rotation/scale of each prim in a link set and "playing it back" to much more complicated algorithms implementing hierarchal linkage schemes.

 

AutoCAD is mostly unsuited for Second Life development btw. You'll find a lot less frustration if you transferred your work as early as possible in the work flow to Blender, which is much more SL friendly.

 

You'll find just learning what you think you need in LSL to end up taking more time than learning the basics of LSL first and then proceeding to get into more complex programming. Skipping the basics is never a shortcut. Simply figuring out the common causes and cures of "Syntax Error" might be a good starting point in your case.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3810 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...