Jump to content

Problems using llGetObjectDetails for position


Strider Kling
 Share

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

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

Recommended Posts

Hi, what I've been trying to do is make it so that when one object collides with floor or an object, it becomes locked in place (which is done in a seperate script) then says something on a hidden channel. another object then responds, and the initial object uses llGetObjectDetails to make it so that when bumped into bya person, it says the information of the second prim in the form of:      region/x/y/z

The second prim as a clone of this script with the words orange and blue inverted, so it can do the same thing.

My problem is that when i bump into it, what i get is region///

im not even excited about the region part since their in the same region so i just had the object detect its own region.

so, sorry for the long explination, but can anyone help me solve the problem? (A formatted version can be found here: http://s1038.photobucket.com/albums/a469/buddy65/?action=view&current=Bluescript.png , ignore the highlights, i didnt realise i had done that)

 

key owner;
list parts;
string regionName;string name;string orangeX;string orangeY;string orangeZ;
vector portalLocation;vector v;
default {    on_rez(integer s)    {        owner = llGetOwner();        regionName = llGetRegionName();    }    state_entry()    {        owner = llGetOwner();        llListen(4,"",NULL_KEY,"");    }    listen(integer channel,string name,key id,string message)    {          if(message == (string)owner + " orange")        {            vector v = llList2Vector(llGetObjectDetails(llDetectedKey(0), [OBJECT_POS]),0);            v.x = (float)orangeX;            v.y = (float)orangeY;            v.z = (float)orangeZ;            llSay(4,(string)owner + " blue");                }}land_collision_start( vector pos ){    llSay(4,(string)owner + " blue");} collision(integer num_detected)    {        if (llDetectedType(0) & AGENT)        {            llSay(0,regionName + "/" + orangeX + "/" + orangeY + "/" + orangeZ);        }        else        {            llSay(4,(string)owner + " blue");     }    }}

Link to comment
Share on other sites

Erm - llDetectedkey() doesn't work in listen - you have the id parameter, orangeX, T, Z are never given any value and overwrite anything you got from llGetObjectDetails() anyway, listen in 'orange' replies to 'blue' which, from your description, will reply to 'orange', will reply to 'blue' ....., collision() fires repeatedly - you probably want to use collision_start() or _end()

That'll do for a start

Link to comment
Share on other sites

key owner;string regionName;vector orange;default{	on_rez( integer s ){		owner = llGetOwner();		regionName = llGetRegionName();	}		state_entry(){		owner = llGetOwner();		llListen( 4, "", "", "" );	}		listen( integer channel, string name, key id, string message ){		if (message == (string)owner + " orange"){			vector temp = llList2Vector( llGetObjectDetails( id, [OBJECT_POS] ), 0 );			if (orange != temp){				orange = temp;				llSay(4,(string)owner + " blue");			}		}	}		land_collision_start( vector pos ){		llSay(4,(string)owner + " blue");	}		collision_start( integer num_detected ){		if (llDetectedType(0) & AGENT){			llSay( 0, regionName + "/" + (string)orange.x + "/" + (string)orange.y + "/" + (string)orange.z );		}else{			llSay(4,(string)owner + " blue");		}	}}

 

try that to start with, and good luck with your portal gun

ETA:

something is very screwy with the editor

Link to comment
Share on other sites

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...