Jump to content

need help with greeter script


danicah
 Share

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

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

Recommended Posts

i need help with a greeter script. I modified a free script so it recognizes display names, but theres still something wrong with the list output:

[23:15] Dani's Welcome Greeter: Dani's Welcome Greeterlist:
Dani
 (
danicah Resident
)
Total = 4 Visitor(s)

 It looks messed up, and I would like to have that in one line please, how can i do that?

Here is part of the script where the name gets stored in the list:

        targetlist=(targetlist=[])+targetlist+ llGetDisplayName(target) + " (" + targetname + ")";

 Any ideas?

 

Link to comment
Share on other sites

Like darkie said its hard to tell much from this but looking at it i would do away with the brackets and just start a new line for a nicer read out like this.

targetlist=(targetlist=[])+targetlist+ llGetDisplayName(target) + targetname + "\n";

this should just start a new line for each name and look nicer as your brackets are on their own line and look messy.

 

Link to comment
Share on other sites

ok let me show you the whole script, might be easier:

// Welcome Mat Script by Alice Klinger// If you change something, hit the "Save" button to save your change string hours;string myemail;string IM;string greetingmessage;integer EmailingTimeInHours;integer scanradius;integer scaninterval;string gName; integer gLine = 0;  key gQueryID; key owner;key target;list targetlist;MailList(){string text = llGetObjectName()+"list:\n";integer len = llGetListLength( targetlist );integer i;for( i = 0; i < len; i++ ){text += llList2String(targetlist, i) + "\n";}text += "Total = " + (string)len; llInstantMessage(llGetOwner(), llGetObjectDesc()+text+" Visitor(s)" ); llEmail(myemail, llGetObjectDesc()+" List", text);targetlist = [];}//finding out if the visitor is on the list yet or notinteger matching1(string targetname){            integer itemslistlength=llGetListLength(targetlist);        integer k;                for(k = 0; k < itemslistlength; k++)        {            if(llList2String(targetlist, k) == targetname)            {                return TRUE;            }                    }        return FALSE;}default {    state_entry()    {        if(llGetInventoryName(INVENTORY_NOTECARD,0)=="_configuration")        {        gLine=0;        gName = "_configuration";        gQueryID = llGetNotecardLine(gName, gLine);        llOwnerSay("Alright starting to work");        }                else        {        llOwnerSay("Put the _configuration notecard into this object");        EmailingTimeInHours=24*3600;//daily            scanradius=10;//10 meter            scaninterval=30;//30 seconds            IM="Yes";            greetingmessage="Welcome, ";        llSetTimerEvent(EmailingTimeInHours);        owner=llGetOwner();      llSensorRepeat("", "", AGENT, scanradius, PI, scaninterval);        }         }        on_rez(integer any)    {        llResetScript();    }        sensor(integer total_number)    {                integer k;        llDetectedKey(k);                for(k=0;k<total_number;k++)        {        target = llDetectedKey(k);                string targetname = llKey2Name(target);                         if(matching1(targetname) == FALSE)        {         llInstantMessage(target,greetingmessage+" " + llGetDisplayName(target));                        string note = llGetInventoryName(INVENTORY_NOTECARD, 1);        string landmark = llGetInventoryName(INVENTORY_LANDMARK, 0);        string sound = llGetInventoryName(INVENTORY_SOUND, 0);        string object = llGetInventoryName(INVENTORY_OBJECT, 0);                               if(llToLower(IM)=="yes")        llInstantMessage(llGetOwner(), ": "+ llGetDisplayName(target) + " (" + targetname + ") is visiting.");        if(sound)             llTriggerSound(sound, 1);        if(note)            llGiveInventory(target, note);        if(landmark)            llGiveInventory(target, landmark);        if(object)            llGiveInventory(target, object);         targetlist=(targetlist=[])+targetlist+ llGetDisplayName(target) + " (" + targetname + ")";        if(llGetListLength(targetlist)>200)        MailList();        }        }    }         timer()        {                       MailList();        }        touch_start(integer any)    {        owner=llGetOwner();               key detected=llDetectedKey(0);        if(detected==llGetOwner())        {            llOwnerSay("Configuration stats:\n"+"Email: "+myemail+"\n Welcome message: "+greetingmessage+"\n IM notification: "+(string)IM+"\n Scan radius: "+(string)scanradius+"\n Scan interval: "+(string)scaninterval+"\n Interval for stats in hours: "+(string)hours);        MailList();            llOwnerSay("Visitorlist emailed if you have specified an email to send it to");        }        else        {             llInstantMessage(detected,greetingmessage+" " + llKey2Name(detected));                        string note = llGetInventoryName(INVENTORY_NOTECARD, 1);        string landmark = llGetInventoryName(INVENTORY_LANDMARK, 0);        string sound = llGetInventoryName(INVENTORY_SOUND, 0);        string object = llGetInventoryName(INVENTORY_OBJECT, 0);        if(sound)             llTriggerSound(sound, 1);        if(note)            llGiveInventory(detected, note);        if(landmark)            llGiveInventory(detected, landmark);        if(object)            llGiveInventory(detected, object);        }    }         dataserver(key query_id, string data)     {        if (query_id == gQueryID)         {            if (data != EOF)             {                            if(llGetSubString(data,0,14)=="Welcome message")            greetingmessage=llGetSubString(data,16,-1);            if(llGetSubString(data,0,15)=="Send IM (Yes/No)")            IM=llGetSubString(data,17,-1);            if(llGetSubString(data,0,4)=="Email")            myemail=llGetSubString(data,6,-1);            if(llGetSubString(data,0,10)=="Scan radius")            scanradius=(integer)llGetSubString(data,12,-1);            if(llGetSubString(data,0,12)=="Scan interval")            {            scaninterval=(integer)llGetSubString(data,14,-1);            llSensorRepeat("", "", AGENT, scanradius, PI, scaninterval);              }            if(llGetSubString(data,0,26)=="Interval for stats in hours")            {            hours=llGetSubString(data,28,-1);            EmailingTimeInHours=3600*(integer)llGetSubString(data,28,-1);                }                         ++gLine;                                      gQueryID = llGetNotecardLine(gName, gLine);                }        }    }        changed(integer change)    {        if(change &CHANGED_INVENTORY)        {            if(llGetInventoryName(INVENTORY_NOTECARD,0)=="_configuration")            {        gLine=0;        gName = "_configuration";        gQueryID = llGetNotecardLine(gName, gLine);        llOwnerSay("Alright got it starting to work");            }                else            {        llOwnerSay("Put the _configuration notecard into this object");        EmailingTimeInHours=24*3600;//daily            scanradius=10;//10 meter            scaninterval=30;//30 seconds            IM="yes";            greetingmessage="Welcome, ";        llSetTimerEvent(EmailingTimeInHours);        owner=llGetOwner();      llSensorRepeat("", "", AGENT, scanradius, PI, scaninterval);            }        }    }                    }

 

Link to comment
Share on other sites

The problem is that it's treating the Display Name, the opening parenthesis, the targetname and the closing parenthesis as separate elements in the list.

I think (though I haven't tested it) you can solve it simply by building your list thus:

 targetlist=(targetlist=[])+targetlist+ [llGetDisplayName(target) + " (" + targetname + ")"];

 That is, by enclosing each unit of DisplayName+ (targetname) in [square brackets].

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4299 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...