Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

old sword script no longer works?

Simon Metalhead
Rock Star
Join date: 26 May 2003
Posts: 187
03-22-2005 14:55
eh everyone, just wondering if there's an update to that old sword script that used to be floating around... from about 2 years ago now i guess but i noticed that it gives an owner permission error now so i'm guessing one of the recent versions caused it to no longer work? anyone happen to have an update or fix for this error? I'll try to post the script later when I'm home from work but that won't be for 8 hours :)
_____________________
Come visit me at Natoma (0,0)
_________________________________
Come check out www.rock66.com and sign up! We have given away lots of L$ in our SL Arcade contests! Keep an eye out for more upcoming contests!
Simon Metalhead
Rock Star
Join date: 26 May 2003
Posts: 187
03-23-2005 01:59
Hmm okay, this is the script i have... it's very old but anyone have any idea why it doesn't work anymore? I don't get any requests for permission when I wield it and when I remove it, I get a permission not set problem... any help would be kewl, thanks :D

CODE
integer SWORD = 1; 
integer PUNCH12 = 2;
integer PUNCHL = 3;
integer KICK = 4;
integer FLIP = 5;

integer strike_type;

default
{
state_entry()
{
llSetStatus(STATUS_BLOCK_GRAB, TRUE);
}
run_time_permissions(integer perm)
{
if (perm)
{
llTakeControls(CONTROL_ML_LBUTTON | CONTROL_LBUTTON | CONTROL_UP | CONTROL_FWD | CONTROL_BACK | CONTROL_ROT_LEFT | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ROT_RIGHT | CONTROL_DOWN, TRUE, TRUE);
}
}

attach(key on)
{
if (on != NULL_KEY)
{
integer perm = llGetPermissions();

if (perm != (PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION))
{
llRequestPermissions(on, PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
}
else
{
llTakeControls(CONTROL_ML_LBUTTON | CONTROL_LBUTTON | CONTROL_UP | CONTROL_FWD | CONTROL_BACK | CONTROL_ROT_LEFT | CONTROL_LEFT | CONTROL_RIGHT | CONTROL_ROT_RIGHT, TRUE, TRUE);
}

}
else
{
llSay(0, "releasing controls");
llTakeControls(FALSE, TRUE, TRUE);
}
}

timer()
{
if ( (strike_type == FLIP)
|| (strike_type == SWORD))
{
llSensor("", "", ACTIVE | AGENT, 4.0, PI_BY_TWO*0.5);
}
else
{
llSensor("", "", ACTIVE | AGENT, 3.0, PI_BY_TWO*0.5);
}
llSetTimerEvent(0.0);
}

control(key owner, integer level, integer edge)
{
if (level & (CONTROL_ML_LBUTTON | CONTROL_LBUTTON))
{
if (edge & CONTROL_UP)
{
llApplyImpulse(<0,0,3.5>,FALSE);
llStartAnimation("backflip");
llTriggerSound("sword effect 1", 0.5);
llSetTimerEvent(0.25);
strike_type = FLIP;
}
if (edge & CONTROL_FWD)
{
llStartAnimation("sword_strike_R");
llSleep(0.5);
llTriggerSound("sword effect 1", 0.5);
llSetTimerEvent(0.25);
strike_type = SWORD;
}
if (edge & (CONTROL_LEFT | CONTROL_ROT_LEFT))
{
llStartAnimation("punch_L");
llTriggerSound("punch", 0.5);
llSetTimerEvent(0.25);
strike_type = PUNCHL;
}
if (edge & (CONTROL_RIGHT | CONTROL_ROT_RIGHT))
{
llStartAnimation("punch_onetwo");
llTriggerSound("punch", 0.5);
llSetTimerEvent(0.25);
strike_type = PUNCH12;
}
if (edge & CONTROL_BACK)
{
llStartAnimation("kick_roundhouse_R");
llTriggerSound("punch", 0.5);
llSetTimerEvent(0.25);
strike_type = KICK;
}
if (edge & CONTROL_DOWN)
{
llMoveToTarget(llGetPos(), 0.25);
llSleep(1.0);
llStopMoveToTarget();
}
}
}

sensor(integer tnum)
{
vector dir = llDetectedPos(0) - llGetPos();
dir.z = 0.0;
dir = llVecNorm(dir);
rotation rot = llGetRot();
if (strike_type == SWORD)
{
llTriggerSound("sword effect 1", 0.5);
dir += llRot2Up(rot);
dir *= 200.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == PUNCH12)
{
llTriggerSound("punch", 0.2);
dir += dir;
dir *= 100.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == PUNCHL)
{
llTriggerSound("punch", 0.2);
dir -= llRot2Left(rot);
dir *= 100.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == KICK)
{
llTriggerSound("punch", 0.2);
dir += dir;
dir *= 100.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == FLIP)
{
llTriggerSound("punch", 0.5);
llPushObject(llDetectedKey(0), <0,0,150>, ZERO_VECTOR, FALSE);
}
strike_type= 0;
}
}
_____________________
Come visit me at Natoma (0,0)
_________________________________
Come check out www.rock66.com and sign up! We have given away lots of L$ in our SL Arcade contests! Keep an eye out for more upcoming contests!
Buck Weaver
Unsolicited Onterator
Join date: 18 May 2003
Posts: 251
03-23-2005 03:23
Isn't this the one that you have to hold down the left mouse button to get it to work? I had forgot about that and thought it stopped working also until someone reminded me.
_____________________
My karma ran over your dogma.

Thoughts become things.
Owl Patel
Fish miner.
Join date: 7 Jul 2004
Posts: 2,300
03-23-2005 05:13
From: Buck Weaver
Isn't this the one that you have to hold down the left mouse button to get it to work? I had forgot about that and thought it stopped working also until someone reminded me.


Yup, thats the one! But, the old lightsabers still work dont they? I swear I used a sword in the current version... yes, I did! About 2 weeks ago.
_____________________
The immortal words of Relk:

From: Relk Akula
I'm not an elitist..well actually I am.

I am superior to any idiot rap-head.

I am superior to many of you.

Any skater is superior to many of you.

I acknowledge that, and I am proud to say it.


http://www.overthar.com/

-High Reagent Patel
Simon Metalhead
Rock Star
Join date: 26 May 2003
Posts: 187
03-23-2005 21:16
hmm, will try the click method when I get home... I don't recall having to do that before but that was so long ago... pretty much all my items that had the sword script don't seem to work anymore... such as waste of L$ back when L$ was more scarce :)
_____________________
Come visit me at Natoma (0,0)
_________________________________
Come check out www.rock66.com and sign up! We have given away lots of L$ in our SL Arcade contests! Keep an eye out for more upcoming contests!
Simon Metalhead
Rock Star
Join date: 26 May 2003
Posts: 187
03-24-2005 17:16
<grumble> didn't work... not sure why this is broken now... kinda upsetting because i guess i need to go through my inventory and delete all the (no copy) (no modify) items that I bought from before... anyone know where I can find a 'working' script so I can put it into the other weapons I wanna swing around? :D
_____________________
Come visit me at Natoma (0,0)
_________________________________
Come check out www.rock66.com and sign up! We have given away lots of L$ in our SL Arcade contests! Keep an eye out for more upcoming contests!
TwoPercent Milk
Homogenized
Join date: 12 Oct 2004
Posts: 9
03-25-2005 19:56
It's not broken. It's just using an incorrect method of releasing controls. In the attach state, when it is releasing controls from being unattached, it is using "llTakeControls(FALSE,TRUE,TRUE);". Replace this with "llReleaseControls" and the error box won't appear.