Jump to content

Simple? Or?


Guest
 Share

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

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

Recommended Posts

I am so used to the old scripting that much the stuff I have done in the past isnt working.   

Im not an that up to date on scritping to be honest.  Im trying to do a menu, that will pick objects at a 90m range or Avi at 90m range, then once selected from the list an object can be rezed and that object will go to that Avi or object. 

 

I am posting the code from the menu that I was using. 

integer schan =9877;
integer oh;
//integer fchan = -9787;
string target;
integer ammo_type;
integer gmode = 0; // 0 = dead fire, 1 = normal seeker, 2 = long range
key guser;
string toucher;
key sound = "c898da75-7319-3c2b-6daa-0ed233b8555a";
list lstMenu = ["Fire","Mode","Target Menu","Clear Target"];
list lstMode = ["Dumb Fire","Tracking", "Back..."];
list lstTargetMenu = [ "Target Player", "Target Objects", "Back..."];

integer uuid2int(key id){
    return (-(integer)("0x" + llGetSubString(id, 19, 35)));
}

init(){
    schan = uuid2int(llGetOwner()) + 753400;
}

integer sbDialog(key keyAgent, string strMessage, list lstButtons, integer intChannel) {
    integer intHandle;

    lstButtons =
        llList2List(lstButtons, -3, -1) +
        llList2List(lstButtons, -6, -4) +
        llList2List(lstButtons, -9, -7) +
        llList2List(lstButtons, -12, -10);

    intHandle = llListen(intChannel, "", keyAgent, "");
    llDialog(keyAgent, strMessage, lstButtons, intChannel);
    return intHandle;
}



default
{
    on_rez(integer start){
        llResetScript();
    }
    state_entry(){
        llListenRemove(oh);
        llSetText("Missle Control",<1.,0.,0.>,0.5);
        init();
    }
    touch_start(integer total_number){
        toucher = llDetectedName(0);
        guser = llDetectedKey(0);
         oh = llListen(schan, "",guser,"");
            llSetTimerEvent(30);
            sbDialog(guser,"Boom Boom Menu",lstMenu,schan);
    }

   
    listen(integer channel, string name, key id, string message){
        string m = llToLower(message);
        list ml = llParseString2List(m,["|"],[""]);
        string ml0 = llList2String(ml,0); string ml1 = llList2String(ml,1);

        if (ml0 == "psettarget"){
            
            target = ml1;
        }
        else if (m == "fire"){
            llMessageLinked(LINK_SET,0,"fire|"+target+"|5|0|0|"+(string)gmode,NULL_KEY);
        }
        else if(m == "clear target"){
            target = NULL_KEY;
            

        }
        if (m == "mode"){
            sbDialog(guser,"Please choose the Missles mode",lstMode,schan);
            oh = llListen(schan, "",guser,"");
            llSetTimerEvent(30);
        }
        if(m == "target menu"){
            sbDialog(guser,"Please choose the targeting mode",lstTargetMenu,schan);
            
        }
        if(m == "target player"){
            llMessageLinked(LINK_SET, 999, "mtarget_menu", guser);
        }
        if (m == "target objects"){
            llMessageLinked(LINK_SET, 999, "mtarget_objects", guser);
        }
        if (m == "dumb fire"){
            gmode = 0;
            llWhisper(0,"Dumb Fire mode set, no tracking");
        }
        if(m == "tracking"){
            gmode =1;
            llWhisper(0,"Standard Tracking mode.");
        }
        
    }
    timer()
    {
        llListenRemove(oh);
    }
}

This is for a bit of refrence but I am hoping that there is a cleaner and much less complicated way of doing this.  Thinking ill also need to rework a target script as well as do something with the missile script as well. 

Open to suggestions but also open to hire someone to clean this up for me as well! Let me know.

Link to comment
Share on other sites

ah lots of stuff has been wrapped up into nifty function calls these days.it looks like bright blue text most of the time

for example,this is a script for a lightswitch like door that innula and qie helped me with (i mostly just fiddled with it because there helping me learn)

but you can see the diffference.instead of UUID usage and that rather hardcore looking code of yours,this one uses alot of stuff wrapped up fairly neatly

string DOOR_NAME = "alien house door true deal";  // name of the door linkinteger doorLink;integer open = FALSE;findDoorLink(){   // subroutine to identify which link is the door, which will get parameter-toggled    integer thisLink = llGetNumberOfPrims();    do    {        if (DOOR_NAME == llGetLinkName(thisLink))        {            doorLink = thisLink;            return;        }    }    while ( --thisLink);//reduce the value of thisLink each time    // if we ever get down to 0, there's no link named DOOR_NAME    llWhisper(DEBUG_CHANNEL, "name your door link and reset this script.");}     default{    state_entry()    {        findDoorLink();    }    changed(integer change)    {        if (CHANGED_LINK & change)            findDoorLink();    }    touch_start(integer total_number)    {        if (open)        {            llSetLinkPrimitiveParamsFast(doorLink,                [ PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM    // solid, PRIM_COLOR , ALL_SIDES, <0.941, 0.071, 0.745>, 0.60   // visible                ]);        }        else        {            llSetLinkPrimitiveParamsFast(doorLink,                [ PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_NONE  // pass-through-able                , PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, 0.0   // hidden                ]);                    }        open = !open;    }}
  • Like 1
Link to comment
Share on other sites

That's actually not a terribly complicated script and it's not very "unclean" either.  I might suggest using "else if" in place if the "if" options to save unnecessary script time, and putting a llListenRemove at the top of the listen event instead of waiting for the timer to do it, but the overall structure isn't bad.  All of the real work is being done in the companion script(s) that this one is sending link messages to.  This script is just doing menu handling.  If you're looking for a scripter to modify this or any other scripts, though, this is not the place to ask.  Post your request in the InWorld Employment forum.

  • Like 1
Link to comment
Share on other sites

Not the way i would structure the menu, First i would decide the main menu and then the sub menus. I would then do a single if  test for parts of the main menu and anything outside that would be in the next else if.

ADDED. I would say that it entirly depends on what the menu does. Generaly the first if tests  are just for "do this and this end" the else if for maybe data input or maybe a note card reader. I see no point testing if after if when a section can do that in one line.

 

list main_menu =["what the main choices are"];
list options =["whatever are the options are"];
-------------------------------------------------------------------------------
llDialog(ownerid, "Choose an option ", main_menu, menu_chan);
if(message == "This" || message == "That" || message == "Or this" || message == "Or this one")

I would also  close the chanel and kill the timer on choices that are going not going any farther that that choice.

sub menus would be

llDialog(ownerid, "Choose an option ", options, menu_chan);

 ADDED i suggest you write the structure in english first or what ever language is yours before even starting a script. It will save you a lot of stress.

  • Like 1
Link to comment
Share on other sites

Thanks for that.  

 

 I am actually very close to what I need to do but, having a bit of struggle on merging my scripts.  This script below will scan for Avi's and will display them on the menu, i can then choose one from the list, and it sends a object to them, but as an inventory item.  What I really want to do is rez a prim, and that prim then auto travels to that selected Avi. 

The two parts I am struggling with is getting the menu to see objects as well as avatars, and, getting it to rez the follow object. 

 

Menu scanner

key contenido;string fcontenido;integer CHANNEL=423321;list visitor_list;list visitor_key;float rate = 30.0;float range = 50.0;integer count;key owner;integer max;list MAIN=["Scan","Load Missile","Reset","Missile Types ◄"];string M_MAIN="Choose one Avatar";list E_MENU=["<<",">>"];integer isNameOnList( string name ){    integer len = llGetListLength( visitor_list );    integer i;    for( i = 0; i < len; i++ )    {        if( llList2String(visitor_list, i) == name )        {            return TRUE;        }    }    return FALSE;} default{state_entry()            {                  }touch_start(integer num)        {        owner=llGetOwner();        llListen(CHANNEL, "", owner, "");        llDialog(owner, "Pick an Option", MAIN, CHANNEL);        }                        sensor( integer number)    {        integer i;        for( i = 0; i < number; i++ )        {            if( llDetectedKey( i ) != llGetOwner() )            {                string detected_name = llDetectedName( i );                if( isNameOnList( detected_name ) == FALSE )                {                    visitor_list += detected_name;                    visitor_key += llDetectedKey( i );                }            }        }        max=llGetListLength(visitor_list);       }listen(integer channel, string name, key id, string message)    {        if (llListFindList(MAIN + visitor_list + E_MENU, [message]) != -1)        {            if (message == "Scan")            {                count=0;                llSensor( "", "", AGENT, range, TWO_PI);                llDialog(owner, "Pick an Option", MAIN, CHANNEL);            }            else if (message == "Load Missile")            {                list menu_temp = llList2List(visitor_list,count,count +8) + E_MENU;                llDialog(owner, M_MAIN, menu_temp, CHANNEL);            }            else if (message == "Reset")            {                llResetScript();            }            else if (message == "Missle types")            {                string regalo = llGetInventoryName( INVENTORY_OBJECT, 0);                llOwnerSay("Type of Missiles ►►► " +regalo);            }                          else if (message == "<<")            {                count -= 9;                if (count <0) count =0;                list menu_temp = llList2List(visitor_list,count,count +8) + E_MENU;                llDialog(owner, M_MAIN, menu_temp, CHANNEL);            }            else if (message == ">>")            {                count += 9;                if (count >max + 8) count =max - 8;                list menu_temp = llList2List(visitor_list,count,count +8) + E_MENU;                llDialog(owner, M_MAIN, menu_temp, CHANNEL);            }            else if (llListFindList(visitor_list , [message]) != -1)            {                                string regalo = llGetInventoryName( INVENTORY_OBJECT, 0);                llGiveInventory((key)llList2String(visitor_key,llListFindList(visitor_list , [message])), regalo);                llOwnerSay("Sent to "+message);            }        }    }}

The next part is my 

Link to comment
Share on other sites

you lost me on that script.

ADDED, i would say this, you appear to be trying to wnte code to do an RP thing which is far more complicated than i would even attempt at. Sending a missile to an agent when they have moved is bad play, the detected x,y,z should be recorded. That agent could have moved 50 m and still get hit by your method, they could run around anywhere and still be hit which is a foul move. May as well just stand in one place with a big arrow over them. Unles that is what you wanted in any case.

Link to comment
Share on other sites

calm down you,he hasnt said what he wanted it for..

 

he might be making some sort of security device,he might just have this entirely on his own land,in which case he can do as he pleases

you really ought to stop using absolutisms and look at the big picture

sides,as he said this thing only has a range of 90m,so anything past that and the missile wont hit.which pretty much voids your previous concern of an infinite range missile

im actually helping him try and figure it out

the primary problem is that after the first shot the missile gets stuck in the same trajectory

clear target doesnt function like it should

also he desires that the menu doesnt self close after every command change

Link to comment
Share on other sites

i have no idea what your problem is , but i sure find you an irratant and i am not the only one. If you want to go thru life reading ill in a post that is your issue, i can only assume you do that in life generaly, it is not a good why to go. BTW, the statment had no emotion in it at all, it was nothing more than an observation, not that i expect you to understand that.

Link to comment
Share on other sites

the only reason you find me an irritant is because i exude alot of variables that your rather settled little word cant run that well.

also,observation and emotion are quite often the same thing.

no matter the emotion or lack thereof,if you say words like "bad" that many times in one paragraph,its going to be construed as either rude or dismissive or possibly overtly opinionated

i dont actually go through life reading ill in everything,im fully cognizant of the idea of a relative lack of eloquence,indicated by a post or in the case of irl "speech" that in reality is just a data statement,sounding rude and snobbish due to the lack of semantic consideration.

but see,unlike some people i have to live life.and while i dont often encounter it irl,ive learned that no matter the actual circumstance,it is far more efficient in my response if i first scan the possible interaction material,and "if it sounds dismissive,or hostile,than it is"

and while that strategy has the downside of alot of false positives,you'd be surprised how well it works to detect hidden hostilitys

id rather you be a freind.but id also you rather think abit more about whether your statement might be considered hostile or not before you post it >.>

id offer you some kind of gift to alleviate the hostility or misunderstandment between us.but im not sure what you like >.>

Link to comment
Share on other sites

I find you an irratant becouse you appear to know all regardless of those of us that have been writting code in SL for years, i also was rather peeved at your silly attempt at macro and quantum physics for which the mathmatical modal fails in the quantum, then coming up with  the chaos and nonNewtonion  nonsense which has noting to do with a scripting forum. Also if you wish to post a script you ripped of the open souce site at least have the decency of posting the authers name.

BTW, we are not all from you country so do not overlay your thoughts on conversation and putting your own words into others mouths,

Link to comment
Share on other sites

o.O i didnt rip it off the open source site,it was posted in the same thread that our disagreement originally started in

and i did give credit to the two folk that posted the thing in the thread,but seeing as i dont know who originally wrote it i couldnt give credit to the person who did,i dont know where these things come from

and yes in the original thread the conversation had trailed off,way off the script part.

i was merely trying to explain why i coudnt use a typical door script for the thing at the time

perhaps it might be ultimately wrong or stupid,but for me (since i learned english in a rather ad hoc fashion),terms are never stratified

i wasnt trying to be a know it all.i was trying to describe something which otherwise i wouldt have no words for.

how does one describe a solid structure that is obviously a shape yet does not follow any known form of geometry or physics?

i used those terms like non newtonian and chaos,etc. because the strange way they are reminded me of the strange that im trying to make

:) if you would like to teach me your words for such things id be happy to learn

you probably have alot of words for things that i dont >.>

Link to comment
Share on other sites

agreed sir

im currently fiddling around with the actual missile launcher itself.

while im fairly certain ive identified which lines associate with which menu buttons,there is alot of extra code surrounding the "clear target" function

makes me wonder if that doesnt have something to do with the clear target not working

Link to comment
Share on other sites

The main problem is the structure. It needs to written in down in human form first, eg i touch the HUD select that it does this, i made an error i want the main menu back, etc etc. As for the target, that can be a temp xyz

ADDED, i suppose the missile it self coud have a hunt script that the main script passes the agent info, have no idea how to do that tho.

Link to comment
Share on other sites

:S i know.but the script works partially

 

my best guess is that some parts of the script are running into each other,ive been fiddling with this thing since last night,and i oddly enough figured out that even if the code saves,if its not properly written something happens where a function wont happen

should it be completely rewritten or fixed?

how would one properly write a function to clear the target from the object (or script) memory,

of course rewriting the whole thing would be nice.but im not sure whether logic demands perfecting it in this case,or fixing the broken part of the current script to acheive greater efficiency

Link to comment
Share on other sites

To clear up a couple of points,

 

 I am working on a project for a simulator project. This is need of both targeting objects as well as AVI.  I have just about everything I need. In fact, I have purchased 3 full perm scripts that have claimed to do exactly what I need but it appears that something is out of date because it will not track and send where it needs to go.  Spoke with one of the creators to get some help fixing what I purchased and they contacted me and said they would work on fixing it but now have gone off the radar.  Not answering email nor messages or sent note cards. 

 In the end I am purchasing full perm scripts that come close to what i want to do.. (Or what the original purchause should have done by its descritpion but $60. USD later on one script and $20 on another and then another $20 on yet another, All that do not do what they claim because of what appears to be out of date scripting maybe?) I am still having to work it out my self.  What I am hoping for is someone that would be willing to give me a hand with getting my pieces to come together.   I admit that I am not up to speed on all the aspects of coding in world as there is alot that has changed.  If you take the latest script I have posted and drop that into a prim you will see the basics of what I am doing.  The last step is to add an option to the menu to rez an object with a link set invintory item that is directed to the location of the Avi, or Object.  If anyone would like to come have a closer look at what it is i have please let me know, I have my own land where I work on builds and am testing items so feel free to contact me in world.  Sorry to have caused any strife over the subject.

 

Link to comment
Share on other sites

nah it aint strife,me and arnot had abit of a misunderstanding that we just cleared up

 

i did clean it up a little bit,but not by much

still working on it mind you

 

   else if(m == "target menu"){            sbDialog(guser,"Please choose the targeting mode",lstTargetMenu,schan);                    }        else if(m == "target player"){            llMessageLinked(LINK_SET, 999, "mtarget_menu", guser);        }        else if (m == "target objects"){            llMessageLinked(LINK_SET, 999, "mtarget_objects", guser);        }        else if (m == "dumb fire"){            llMessageLinked(LINK_SET, 999, "mdumb_fire", guser);            gmode = 0;            llWhisper(0,"Dumb Fire mode set, no tracking");        }        else if(m == "tracking"){            llMessageLinked(LINK_SET, 999, "mtracking", guser);            gmode =1;            llWhisper(0,"Standard Tracking mode.");        }        
Link to comment
Share on other sites

ok,im making abit of a breakthrough here,im adding text lines to the different menu options

amazing that i figured out how to do that,but i love puzzles

anywho,ill be posting the update pretty soon

EDIT: here we go,now it says what its doing with most menu choices,ive missed a couple but i havent foudn there precise spot yet

  else if(m == "target menu"){         sbDialog(guser,"Please choose the targeting mode",lstTargetMenu,schan);              {        llSay(0, "Engage Target Vector");    }        }        else if(m == "target player"){            llMessageLinked(LINK_SET, 999, "mtarget_menu", guser);            {        llSay(0, "Warning: Lifeform targeting Enabled");    }        }        else if (m == "target objects"){            llMessageLinked(LINK_SET, 999, "mtarget_objects", guser);            {        llSay(0, "Choose object to Attack");    }         }        else if (m == "dumb fire"){            llMessageLinked(LINK_SET, 999, "mdumb_fire", guser);            gmode = 0;                       {        llSay(0, "Warning,Unguided missile launch mode set");    }        }        else if(m == "tracking"){            llMessageLinked(LINK_SET, 999, "mtracking", guser);            gmode =1;            llWhisper(0,"Guided missile launch mode set.");        }
Link to comment
Share on other sites

eh.i think i might give it another shot later on after housework

through much trial and error ive concluded that there is also error in the missile script rather than the menu

the communication for clear the target isnt received by the missile script quite simply because the lsl line for the order reaction isnt there in the missile script

Link to comment
Share on other sites

I have a few things I can show you that I think may fill in the gaps for both of us really. Give me a shout next time your on. Thanks for giving it a go to find a solution. And thank you too Steph.  Once this is working and working well I am posting it up so others that may be looking for the same thing, wont ever have to go through this. 

Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...