After you Subscribe email your username
and receipt to
goonsquad.me@gmail.com
Membership Options
Pay With Bitcoin
  • 25 Vote(s) - 3.32 Average
  • 5
  • 4
  • 3
  • 2
  • 1
Thread Modes

Brasher for NoRez Sims
machinecode Offline
Goonsquad Member
******
Goonsquad

Posts: 209
Threads: 153
Joined: Jul 2014
Reputation: 94
Avatar brasher for no rez sims/zones. Works really well and brashes avatars across sims.

Code:
integer ATTACK;//turned on/off by click-choose and wearing
list avatars;//detected uuids
key targetted;//global so we only need to designate it once

//startup stuff
//---------------------------------------------------------------------
init()
{
    //start a timer in case they don't respond or hit cancel for permissions
    llSetTimerEvent(10);
    
    //request perms
    llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS);
    
    //STOP BONKING (if you were already)
    ATTACK = FALSE;
    
    //stfu
    llStopSound();
}

//this gets someone's name, if it's too long it'll cut it down to button size
//---------------------------------------------------------------------
string get_name(key target)
{
    string fullname = llKey2Name(target);
    
    if(llStringLength(fullname)>24)
    fullname = llGetSubString(fullname,0,23);
    
    return fullname;
}

//this is a list of buttons that the script puts together so you can choose things
//it also comes with next and back buttons if you need them
//---------------------------------------------------------------------
list dialog_list()
{
    list buttons;//the list of buttons we end up seeing
    
    //for starters, when we click this box, get rid of all the avatars NOT in the sim anymore
    integer x = llGetListLength(avatars);
    key id;
    
    //fire through the avatars list backwards - delete anyone who isn't here
    //we're going backwards because deleting things from the list won't affect the next thing we need to check that way
    
    //if x was 3, this would count 2, 1, 0 and then be done
    while(~--x)
    {
        //get their uuid out of the list entry (which looks like this: name|uuid)
        id = llList2Key(llParseString2List(llList2String(avatars,x),["|"],[]),1);
        
        //this will be zero if they are not in the same sim
        if(llGetAgentSize(id)==ZERO_VECTOR)
        avatars = llDeleteSubList(avatars,x,x);//remove from avatars list
    }
    
    //ok so now that we've gotten rid of all the targets that aren't here anymore
    //build a list of people who are here
    
    //alphabetical order
    avatars = llListSort(avatars,1,1);
    
    //we're only allowed 12 buttons; next, back, stop, 9 avs
    integer show=9;
    string name;
    
    //if we don't need a back button, show 10 avs
    if(cur==0)
    show++;
    else
    buttons += "back";
    
    buttons += ["stop","next"];
    
    //make sure we don't have empty buttons by getting rid of empty space
    integer total = llGetListLength(avatars);
    while(cur + show > total)
    show--;
    
    //build buttons
    for(x=0;x<show;x++)
    {
        name = llList2Key(llParseString2List(llList2String(avatars,x+cur),["|"],[]),0);
        buttons += name;
    }
    
    return buttons;
}

//view more avatars
//---------------------------------------------------------------------
next()
{
    cur += 9;
    
    //if you try to go past however many avatars there are - uh, don't.
    if(cur > llGetListLength(avatars))
    {
        cur-= 9;
        llOwnerSay("No additional avatars to display.");
    }
    
    llDialog(llGetOwner(),"SELECT YOUR BATTLESHIP",dialog_list(),-999333555);
}

//view previous avatars
//---------------------------------------------------------------------
back()
{
    cur-= 9;
    
    //i don't know how this would ever happen but i'd rather just make sure it doesn't
    if(cur < 0)
    cur=0;
    
    llDialog(llGetOwner(),"SELECT YOUR BATTLESHIP",dialog_list(),-999333555);
}

//this is for keeping track of which avatars you're looking at
//---------------------------------------------------------------------
integer cur;

//BONK
//---------------------------------------------------------------------
bonk(string target)
{
    integer index = -1;
    integer x;
    for(x=0;x<llGetListLength(avatars);x++)
    {
        if(llSubStringIndex(llList2String(avatars,x),target)!=-1)
        {
            index = x;
            jump break;
        }
    }
    @break;
    
    if(index != -1)//if name is inside the list (-1 happens if it is not in the list)
    targetted = llList2Key(llParseString2List(llList2String(avatars,index),["|"],[]),1);
    
    else
    {
        llOwnerSay("Target invalid.");
        return;
    }
    
    llLoopSound("SLAM2",1);
    //rock and roll
    ATTACK = TRUE;
}

default
{
    //rez it wear it reset it whatever - get their perms for noscript zones
    //---------------------------------------------------------------------
    
    state_entry()
    {
        init();
    }
    on_rez(integer r)
    {
        if(llGetPermissionsKey()!=llGetOwner())
        init();
    }
    attach(key i)
    {
        if(i)
        init();
    }
    
    //they either say yes or no
    //---------------------------------------------------------------------
    
    run_time_permissions(integer p)
    {
        if(!p)//didn't give me perms
        llResetScript();//fuck you give me perms
        
        llSetTimerEvent(0);//we got a response so we don't need to ask for perms again
        
        llListen(-999333555,"","","");//listen for an attack command
        
        llTakeControls(1,1,1);//get controls for noscript
        
        llSensorRepeat("","",AGENT,96,PI,.1);//look for people
        
        llTarget(<-99999,-99999,-99999>,.1);//turbo timer
    }
    
    //YOU ARE TAKING TOO LONG TO SAY YES OR NO FOR PERMISSIONS SO ASK AGAIN
    //---------------------------------------------------------------------
    timer()
    {
        init();
    }
    
    //empty control event so it works in noscript; the event needs to be there
    //---------------------------------------------------------------------

    control(key i, integer held, integer change)
    {}
    
    //what happens when we find people: add them to the avatars list
    //---------------------------------------------------------------------
    
    sensor(integer i)
    {
        integer x;
        string uuid;
        
        //for each detected avatar
        for(x=0;x<i;x++)
        {
            uuid = (string)llDetectedKey(x);//their uuid
            list add = [get_name(uuid)+"|"+uuid];//what we're adding to the list (so we can find it)
            
            if(llGetAgentSize(uuid)!=ZERO_VECTOR)//if they're in the same sim (other sims' avatars cause issues)
            {
                if(llListFindList(avatars,add)==-1)//if their uuid is NOT in the key list
                //add them to the keys list along with their button-sized name
                avatars += add;
            }
            //note that i'm doing this with strings instead of keys, keys are broken for llListFindList
        }
    }
    
    //on click display a menu that shows all the avatars
    //---------------------------------------------------------------------
    touch_start(integer n)
    {
        llDialog(llGetOwner(),"SELECT YOUR BATTLESHIP",dialog_list(),-999333555);
    }
    
    //listen event - they either chose a target or want to see more targets
    //---------------------------------------------------------------------
    listen(integer c, string n, key i, string m)
    {
        //if it's not an object owned by the owner or the owner - disregard
        if(llGetOwnerKey(i)!=llGetOwner())return;
        
        //this should prettymuch explain itself
        if(m=="back")
        back();
        
        else if(m=="next")
        next();
        
        else if(m=="stop")
        {
            ATTACK = FALSE;
            llStopMoveToTarget();
            llStopSound();
        }
        
        else
        bonk(m);
    }
    
    //LEEEEEERRRRROOOOOOOOYYYYYYYYYYY
    //---------------------------------------------------------------------
    not_at_target()
    {
        //if we're not attacking don't do anything
        if(!ATTACK)return;
        
        //figure stuff out
        vector you = llList2Vector(llGetObjectDetails(targetted,[OBJECT_POS]),0);
        vector me = llGetPos();
        vector norm = llVecNorm(you-me);
        vector dest;
        
        //if it's too far for a regular move to target, jump 64m at a time
        if(llVecDist(you,me) > 63)
        dest = norm*63 + llGetPos();
        
        else dest = you;
        
        //zoom
        llApplyImpulse(<0,0,0>,1);
        llMoveToTarget(dest,.045);
        
        //fuckin blam
        llPushObject(llGetOwner(),norm*±3.402823466E+38,<0,0,0>,0);
    }
}

ZeroThe10th Offline
Sleeping in Cyberspace
**********
Admin+

Posts: 1,586
Threads: 911
Joined: Oct 2013
Reputation: 1,985
Oh Master of destructive code, What's a brasher?

machinecode Offline
Goonsquad Member
******
Goonsquad

Posts: 209
Threads: 153
Joined: Jul 2014
Reputation: 94
Well this will simple push the avatar across the sim when hit. Only works in push enabled sims.

Xnowball Offline
Beginner
Registered

Posts: 14
Threads: 1
Joined: Jan 2016
Reputation: 0
hi thank you so much for share ....

dorkiq Offline
Beginner
Registered

Posts: 3
Threads: 1
Joined: Feb 2017
Reputation: 0
Love it! works awesome!






Users browsing this thread: 1 Guest(s)

Color Skins

Change Color:

Background Patterns:

Background Images:

Background Header:

Setting Panel

Main Options: