Hey everyone, I have some doors that get jacked up every time I upload an updated OAR to my SIM...and I am tired of resetting their rotation each time
I used to know a snippet of code but cannot remember it.
Does anyone know the code for setting rotation and position of an object on sim start-up?
THANKS!
Set Rotation on SIM start
- Lunk Portal
- Posts: 133
- Joined: Wed Jan 26, 2022 10:03 am
- Location: Northern Michigan
- Has thanked: 92 times
- Been thanked: 141 times
- Contact:
Set Rotation on SIM start
- These users thanked the author Lunk Portal for the post:
- Ilan Tochner
B. A. Shields (Lunk Portal)
TatooineRP Region
TatooineRP Website
Kitely Market - Lunk's Loot
My Novels and other Projects
https://linktr.ee/bashields
TatooineRP Region
TatooineRP Website
Kitely Market - Lunk's Loot
My Novels and other Projects
https://linktr.ee/bashields
- Iain McCracken
- Posts: 25
- Joined: Thu Feb 21, 2013 6:35 pm
- Has thanked: 38 times
- Been thanked: 14 times
Re: Set Rotation on SIM start
You can use the "changed" event to detect sim restart using the "CHANGED_REGION_START" constant... So, this code inside the root prim of the door might be something like what you're looking for. I don't have a live sim right now so I can't test the sim restart on oar upload.
Code: Select all
changed(integer why)
{
if (why & CHANGED_REGION_START)
{
llSetRot(blah);
}
}
- These users thanked the author Iain McCracken for the post (total 3):
- Ilan Tochner • Lunk Portal • Graham Mills
- Lunk Portal
- Posts: 133
- Joined: Wed Jan 26, 2022 10:03 am
- Location: Northern Michigan
- Has thanked: 92 times
- Been thanked: 141 times
- Contact:
Re: Set Rotation on SIM start
I’ll give this a try next time I’m on and let you know either wayIain McCracken wrote: ↑Sat Jun 25, 2022 5:03 pmYou can use the "changed" event to detect sim restart using the "CHANGED_REGION_START" constant... So, this code inside the root prim of the door might be something like what you're looking for. I don't have a live sim right now so I can't test the sim restart on oar upload.
Code: Select all
changed(integer why) { if (why & CHANGED_REGION_START) { llSetRot(blah); } }
B. A. Shields (Lunk Portal)
TatooineRP Region
TatooineRP Website
Kitely Market - Lunk's Loot
My Novels and other Projects
https://linktr.ee/bashields
TatooineRP Region
TatooineRP Website
Kitely Market - Lunk's Loot
My Novels and other Projects
https://linktr.ee/bashields
- Lunk Portal
- Posts: 133
- Joined: Wed Jan 26, 2022 10:03 am
- Location: Northern Michigan
- Has thanked: 92 times
- Been thanked: 141 times
- Contact:
Re: Set Rotation on SIM start
Yeah, I can't seem to get this to work...my script skills are weak LOL
B. A. Shields (Lunk Portal)
TatooineRP Region
TatooineRP Website
Kitely Market - Lunk's Loot
My Novels and other Projects
https://linktr.ee/bashields
TatooineRP Region
TatooineRP Website
Kitely Market - Lunk's Loot
My Novels and other Projects
https://linktr.ee/bashields
-
- Posts: 1314
- Joined: Sun Dec 23, 2012 2:26 pm
- Has thanked: 1134 times
- Been thanked: 1142 times
Re: Set Rotation on SIM start
Is it part of a linkset?Lunk Portal wrote: ↑Mon Jun 27, 2022 5:54 pmYeah, I can't seem to get this to work...my script skills are weak LOL
- Lunk Portal
- Posts: 133
- Joined: Wed Jan 26, 2022 10:03 am
- Location: Northern Michigan
- Has thanked: 92 times
- Been thanked: 141 times
- Contact:
Re: Set Rotation on SIM start
I have a hinge, which is the parent so there are 2 primsGraham Mills wrote: ↑Mon Jun 27, 2022 10:02 pmIs it part of a linkset?Lunk Portal wrote: ↑Mon Jun 27, 2022 5:54 pmYeah, I can't seem to get this to work...my script skills are weak LOL
B. A. Shields (Lunk Portal)
TatooineRP Region
TatooineRP Website
Kitely Market - Lunk's Loot
My Novels and other Projects
https://linktr.ee/bashields
TatooineRP Region
TatooineRP Website
Kitely Market - Lunk's Loot
My Novels and other Projects
https://linktr.ee/bashields
-
- Posts: 1314
- Joined: Sun Dec 23, 2012 2:26 pm
- Has thanked: 1134 times
- Been thanked: 1142 times
Re: Set Rotation on SIM start
Lightly modded version of example script https://wiki.secondlife.com/wiki/LlGetLocalRot
NB hinge is root, door is sliced and script is placed in door.
NB hinge is root, door is sliced and script is placed in door.
Code: Select all
//--// Door Script - Works At ANY Angle //--//
//-- works in ANY single prim door, linked or un-linked
//-- works in muti prim doors NOT linked to a larger structure
//-- REQUIREMENTS: a cut root prim. Suggest cube, pathcut start=.125, end=.625
//-- CAVEAT: single prim doors are limited to 5m width
//--// USERS MODIFY HERE v
integer vgIntDoorSwing = 90;
//-- use -# to reverse the direction of swing, eg. -90;
rotation gRotDoorSwing;
default{
state_entry(){
gRotDoorSwing = llEuler2Rot( <0.0, 0.0, vgIntDoorSwing> * DEG_TO_RAD );
}
changed(integer change)
{
if (change & CHANGED_REGION_RESTART)
{
llSetLocalRot(ZERO_ROTATION);
}
}
touch_start( integer vIntTouched ){
llSetLocalRot( (gRotDoorSwing = ZERO_ROTATION / gRotDoorSwing) * llGetLocalRot() );
}
}
- These users thanked the author Graham Mills for the post (total 3):
- Ilan Tochner • Lunk Portal • Iain McCracken