Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Pillow Fighter script not working?

Silvia Kraken
Registered User
Join date: 19 Mar 2005
Posts: 2
04-14-2005 03:51
My pillow fighter doesn't work since the last update. Is it just that a setting is no longer valid? I am still learning the script basics in here, so I am hoping someone knows of a known issue.

Script:

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";);
llSetTimerEvent(0.25);
strike_type = FLIP;
}
if (edge & CONTROL_FWD)
{
llStartAnimation("sword_strike_R";);
llSleep(0.5);
llSetTimerEvent(0.25);
strike_type = SWORD;
}
if (edge & (CONTROL_LEFT | CONTROL_ROT_LEFT))
{
llStartAnimation("punch_L";);
llSetTimerEvent(0.25);
strike_type = PUNCHL;
}
if (edge & (CONTROL_RIGHT | CONTROL_ROT_RIGHT))
{
llStartAnimation("kick_roundhouse_R";);
llSetTimerEvent(0.25);
strike_type = KICK;
}
if (edge & CONTROL_BACK)
{
llStartAnimation("punch_onetwo";);
llSetTimerEvent(0.25);
strike_type = PUNCH12;
}
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("crunch", 0.5);
dir += llRot2Up(rot);
dir *= 1000.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == PUNCH12)
{
llTriggerSound("crunch", 0.2);
dir += dir;
dir *= 1000.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == PUNCHL)
{
llTriggerSound("crunch", 0.2);
dir -= llRot2Left(rot);
dir *= 1000.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == KICK)
{
llTriggerSound("crunch", 0.2);
dir += dir;
dir *= 1000.0;
llPushObject(llDetectedKey(0), dir, ZERO_VECTOR, FALSE);
}
else if (strike_type == FLIP)
{
llTriggerSound("crunch", 0.2);
llPushObject(llDetectedKey(0), <0,0,150>, ZERO_VECTOR, FALSE);
}
strike_type= 0;
}
}


Thanks
Sil
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
I have an old pillow fighting script
04-14-2005 05:37
I have an old pillow fighting script, I don't know if it bears any resemblance to yours or not, and it too used to work fine but stopped working. I did post a message in the scripting forum but I don't think I got a single response.

What does the script you posted fail to do? Do it give any error messages? Do you need to drop it on the ground before you attach it?

(Note: The World is down, and I just got up. I am not actually looking at the code. )

I suppose you have looked word by word in the Wiki to see if any updates have made you need to change some code?
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-
Torley Linden
Enlightenment!
Join date: 15 Sep 2004
Posts: 16,530
04-14-2005 06:41
Is that the pillow fighting script Francis Chung made way back in 1.1? I remember playing with -- wait, I wasn't even here (in theory). But she'd be the one to ask about this when she gets some free time and her Internet works well again (which I hope it does, I say thankya).
_____________________
Zalandria Zaius
Registered User
Join date: 17 Jan 2004
Posts: 277
animation scripts
04-14-2005 07:42
That last patch made a holy mess out of animation permissions. I know they did it for the dance machines and stuff so they wouldn't spam but it wrecked a number of things..

Not only does the item loose animation permissions,when it can't find it's AV that permitted it looses ALL permissions.

I with they'd just give us some ding dang error handling and quit with these hacks..

//end rant

That being said, maybe they put a fix to it in this patch. I didn't see any mention of it though. Try recompiling it when the Servers are back up.