Change font size
It is currently Thu Sep 09, 2010 10:29 pm

Forum rules


Image



Post a new topicPost a reply Page 1 of 1   [ 2 posts ]
Author Message
 Post subject: Need some advise to get my scripts working
PostPosted: Fri Jul 16, 2010 1:01 pm 

Joined: Fri Jul 16, 2010 12:49 pm
Posts: 1
noob alert!!! :o

I have just installed standalone opensim-0.6.9-binaries on a Windows 7 machine with 4GB and an amd dual core x64 5200+ CPU (2.&mhz)

Now all seems to be up and running pretty good (have a good few regions) and have been landscaping along, no issues whatsoever.

I made no chnages to the binaries other then the steps that were included with the setup documentation

However, I just tried to use a simple boat script like this:

// Very simple vehicle script, mod for OpenSim & ODE & VEHICLE code
// By Kitto Flora September 2009

// modified by Hiro Protagonist for basic aquatic motorcraft
// September 2009

integer Private = 1; // Change to 1 to prevent others riding.

vector Sitpos = <0.35,0,0.35>;
vector SitrotV = <0,-20,0>;
rotation Sitrot;
integer tt;
key oldagent;
key agent;
float forward_power = 8; //Power used to go forward (1 to 30)
float reverse_power = -3; //Power ued to go reverse (-1 to -30)
float turning_ratio = 1.0; //How sharply the vehicle turns. Less is more sharply. (.1 to 10)
integer scount;
integer Speed;
integer Run;

string sit_message = "Man the Helm"; //Sit message
string not_owner_message = "You are not the owner of this vehicle, buy a copy for 0$ and have your own to test in this sim. It will not work in other Open Sim Regions."; //Not owner message

setVehicle()
{
//boat
llSetVehicleType(VEHICLE_TYPE_BOAT);
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY, 0.2);
llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_EFFICIENCY, 0.80);
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 0.10);
llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 0.10);
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_TIMESCALE, 1.0);
llSetVehicleFloatParam(VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, 0.1);
llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_TIMESCALE, 0.1);
llSetVehicleFloatParam(VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, 0.1);
llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <10.0, 2.0, 1000.0>);
llSetVehicleVectorParam(VEHICLE_ANGULAR_FRICTION_TIMESCALE, <0.1, 0.1, 0.1>);
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.250);
llSetVehicleFloatParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 0.250);

}
Init()
{
Sound(0);
llSetBuoyancy(1);
llSetStatus(STATUS_PHYSICS, FALSE);
vector here = llGetPos();
float h = llWater(<0,0,0>) + 0.22;
vector rotv = llRot2Euler(llGetRot());
rotation rot = llEuler2Rot(<0,0,rotv.z>);
llSetPos(<here.x, here.y,h>);
llSetRot(rot);
Sitrot = llEuler2Rot(DEG_TO_RAD * SitrotV);
llSetVehicleType(VEHICLE_TYPE_NONE);
llMessageLinked(LINK_ALL_OTHERS, 0, "S", NULL_KEY); // wheels stop
llMessageLinked(LINK_ALL_OTHERS, 0, "WC", NULL_KEY); // wheels straight
Run = 0;
}

SetMaterial()
{
llSetPrimitiveParams([PRIM_MATERIAL, PRIM_MATERIAL_WOOD]);
// llMessageLinked(LINK_ALL_OTHERS, 0, "SetMat", NULL_KEY); // Tell daughter pims on ground to be glass
}

Sound(integer n)
{
integer oldn;
if(n != oldn)
{
oldn = n;
if(n == 2)
{
// llLoopSound("RUNNING",1);
}
else if(n == 1)
{
// llLoopSound("IDLE",1);
}
else
{
// llStopSound();
}
}
}

default
{
state_entry()
{
Init();
llSetSitText(sit_message);
// forward-back,left-right,updown
llSitTarget(Sitpos, Sitrot);
// llStopSound();
}

on_rez(integer rn){
llResetScript();
}

changed(integer change)
{
if ((change & CHANGED_LINK) == CHANGED_LINK)
{
agent = llAvatarOnSitTarget();
if (agent != NULL_KEY)
{
if( (agent != llGetOwner()) && (Private == 1) )
{
llSay(0, not_owner_message);
llUnSit(agent);
// not functional llPushObject(agent, <0,0,50>, ZERO_VECTOR, FALSE);
}
else
{
//llTriggerSound("car_start",1);
// llMessageLinked(LINK_ALL_CHILDREN , 0, "WHEEL_DRIVING", NULL_KEY);
oldagent = agent;
setVehicle();
SetMaterial();
llSleep(.4);
llSetStatus(STATUS_PHYSICS, TRUE);
llSleep(.1);
Run = 1;
//Sensor is to make a crude Timer as TimerEvent fails on vehicles
llSensor("Non-Entity",NULL_KEY,PASSIVE,1.0, PI_BY_TWO);

llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION | PERMISSION_TAKE_CONTROLS);
Sound(1);
}
}
else
{
Init();
llSleep(.4);
llReleaseControls();
llMessageLinked(LINK_ALL_OTHERS, 0, "S", NULL_KEY);
Run = 0;
llStopSound();
}
}
}

touch_start(integer tn){
}

run_time_permissions(integer perm)
{
if (perm)
{
llTakeControls(CONTROL_FWD | CONTROL_BACK | CONTROL_DOWN | CONTROL_UP | CONTROL_RIGHT |
CONTROL_LEFT | CONTROL_ROT_RIGHT | CONTROL_ROT_LEFT, TRUE, FALSE);
}
}

control(key id, integer level, integer edge)
{
integer reverse=1;
vector angular_motor;

//get current speed
vector vel = llGetVel();
float speed = llVecMag(vel);

//car controls
if(level & CONTROL_FWD)
{
llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <10.0, 2.0, 1000.0>);
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <forward_power,0,0>);
reverse=1;
// NewWheelrot = "F";
Speed = 20;
}
if(level & CONTROL_BACK)
{
llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <10.0, 2.0, 1000.0>);
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <reverse_power,0,0>);
reverse = -1;
// NewWheelrot = "R";
Speed = 10;
}

if(level & (CONTROL_RIGHT|CONTROL_ROT_RIGHT))
{
angular_motor.z -= speed / turning_ratio * reverse;
// NewWheeldir = "WR";
// turncount = 10;
}

if(level & (CONTROL_LEFT|CONTROL_ROT_LEFT))
{
angular_motor.z += speed / turning_ratio * reverse;
// NewWheeldir = "WL";
// turncount = 10;
}

llSetVehicleVectorParam(VEHICLE_ANGULAR_MOTOR_DIRECTION, angular_motor);
// if(turncount > 0)
// {
// turncount--;
// }
// if(turncount == 1)
// {
// NewWheeldir = "WC";
// }
// if(Wheeldir != NewWheeldir){
// Wheeldir = NewWheeldir;
// llMessageLinked(LINK_ALL_OTHERS, 0, Wheeldir, NULL_KEY);
// }
// if(Wheelrot != NewWheelrot){
// Wheelrot = NewWheelrot;
// llMessageLinked(LINK_ALL_OTHERS, 0, Wheelrot, NULL_KEY);
// }
} //end control

//Sensor is to make a crude Timer as TimerEvent fails on vehicles
no_sensor()
{
if(scount < 1000)
{
scount++;
}
else
{
scount = 0;
// This happens about once per second
if(Speed > 0) Speed--;

if(Speed > 2) Sound(2);

if(Speed == 1) {
llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1.0, 2.0, 1000.0>);
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <0,0,0>);
// llMessageLinked(LINK_ALL_OTHERS, 0, "S", NULL_KEY);
// Sound(1);
// Wheelrot = "S";
}

}

if(Run == 1)
llSensor("Non-Entity",NULL_KEY,PASSIVE,1.0, PI_BY_TWO);
}

} //end default


I installed the script in the root of the boat (just a 1 prim object to test, smaller then 10X10) but the only thing that happens when I use the direction keys is that the camera zooms or pans. I have tried a few other scripts as well and payed good attention on how to script them (done quite a bit of that in SL) but none of them gets the boat or the vehicle to move...

Any suggestions or tips? It probably be something stupid simple that I forgot to do...


Top
 Profile  
 
 Post subject: Re: Need some advise to get my scripts working
PostPosted: Thu Jul 22, 2010 12:24 pm 
User avatar

Joined: Mon Mar 29, 2010 12:42 pm
Posts: 7
Location: Michigan, USA
Do any other scripts work.e.g. hello ava. or other that don't require moving an object.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 2 posts ]


Who is online

Users browsing this forum: legacy_yahoo [bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
610nm Style by Daniel St. Jules of Gamexe.net