Jump to content

Bot Scripting


dawnalphonse
 Share

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

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

Recommended Posts

Hi ,

I am very new to second life.

I created my self as a bot . I dont know ..I just read it as a scripted agent .

I created my avatar as bot . ThenI dont know what to do . I read the wiki and didn't understand completely as the wiki is messy with different answers .

I have seen one script .  Avatar follower as below . 

integer CHANNEL = 15;  // That's "f" for "follow", haha
 
float DELAY = 0.5;   // Seconds between blinks; lower for more lag
float RANGE = 3.0;   // Meters away that we stop walking towards
float TAU = 1.0;     // Make smaller for more rushed following
 
// Avatar Follower script, by Dale Innis
// Do with this what you will, no rights reserved
// See https://wiki.secondlife.com/wiki/AvatarFollower for instructions and notes
 
float LIMIT = 60.0;   // Approximate limit (lower bound) of llMoveToTarget
 
integer lh = 0;
integer tid = 0;
string targetName = "";
key targetKey = NULL_KEY;
integer announced = FALSE;
 
init() {
  llListenRemove(lh);
  lh = llListen(CHANNEL,"",llGetOwner(),"");
}
 
stopFollowing() {
  llTargetRemove(tid);  
  llStopMoveToTarget();
  llSetTimerEvent(0.0);
  llOwnerSay("No longer following.");
}
 
startFollowingName(string name) {
  targetName = name;
  llSensor(targetName,NULL_KEY,AGENT_BY_LEGACY_NAME,96.0,PI);  // This is just to get the key
}
 
startFollowingKey(key id) {
  targetKey = id;
  llOwnerSay("Now following "+targetName);
  keepFollowing();
  llSetTimerEvent(DELAY);
}
 
keepFollowing() {
  llTargetRemove(tid);  
  llStopMoveToTarget();
  list answer = llGetObjectDetails(targetKey,[OBJECT_POS]);
  if (llGetListLength(answer)==0) {
    if (!announced) llOwnerSay(targetName+" seems to be out of range.  Waiting for return...");
    announced = TRUE;
  } else {
    announced = FALSE;
    vector targetPos = llList2Vector(answer,0);
    float dist = llVecDist(targetPos,llGetPos());
    if (dist>RANGE) {
      tid = llTarget(targetPos,RANGE);
      if (dist>LIMIT) {
          targetPos = llGetPos() + LIMIT * llVecNorm( targetPos - llGetPos() ) ; 
      }
      llMoveToTarget(targetPos,TAU);
    }
  }
}
 
default {
 
  state_entry() {
    llOwnerSay("/"+(string)CHANNEL+" [name of person to magically follow]");
    init();
  }
 
  on_rez(integer x) {
    llResetScript();   // Why not?
  }
 
  listen(integer c,string n,key id,string msg) {
    if (msg == "off") {
      stopFollowing();
    } else {
      startFollowingName(msg);
    }
  }
 
  no_sensor() {
    llOwnerSay("Did not find anyone named "+targetName);
  }
 
  sensor(integer n) {
    startFollowingKey(llDetectedKey(0));  // Can't have two ppl with the same name, so n will be one.  Promise.  :)
  }
 
  timer() {
    keepFollowing();
  }
 
  at_target(integer tnum,vector tpos,vector ourpos) {
    llTargetRemove(tnum);
    llStopMoveToTarget();  
  }
 
}

 

Can I use this script on my bot guide body , so that the other people who login and know me can type my avatar name , so that they can follow me where I go . Is this script meant to be for that . can I use this script on my bot Avatar ?

 

It wil be easy then , if I am a teacher and I can do guidence in second life and my students can follow me easliy in second life.

Hpe I will get clarifications on this code  and also the purpose of bot 

Thanks

Link to comment
Share on other sites

Not quite.  That is a follower script and would need to go into an object that is then worn by your students.

The "scripted agent" thing is a bit misleading.  There was a time when non human controlled avatars would just stand around on land to increase the "traffic count" and make the location look popular.  Since then, you are not permitted to operate methods that artificially raise the traffic statistic of land and to do this, "bots" were only permitted under the following circumstances:-

 

  • The avatar account was set to "scripted agent"
  • The land was not set to show in search

However, this was quite a long time ago and since then, LL have continually dicked around with the way that traffic features in search and it's now not significant, favouring "relevance" instead.  Relevant to LL seems to convey multiple meanings and to many, the whole bots for traffic thing is rather dead.

So, the short answer is that your students need the scripted object, you do NOT need to have "scripted agent" set if you are controlling the avatar at any point.

Link to comment
Share on other sites

Hi, i´ve created some guide-bots for a University sim. They wait for people and show them around the sim - but the visitors still have to follow them manually.

If your guide is human-controlled (by yourself), your students only need to learn the basics of inworld movement to follow you.

If you want to force them to follow you, that´s quite a bit more complicated because you need to permission and a custom SL viewer (free for download but not the official). 

Monti

Link to comment
Share on other sites

Most older scripts expect legacy names.

Nova Convair is a legacy name
botguide resident is a legacy name
botguide is NOT a legacy name

botguide is a username
nova.convair is a username

In addition to this 2 name types there are display names so there are 3 different names for each avatar.

 

Link to comment
Share on other sites


botguide wrote:

I tried for the display as botguide resident . Still it is not working . Showing the message as DId not find anyone named ....

Is it required that both people should be friends in Second life ?

No.  You just have to type the correct name, with all of its spelling, capitalization, and blank spaces.  That begs the larger question, though, of why you are expecting the user to type a name in at all.  If you are having this much trouble, imagine what other users may have.  It would perhaps be wise to make a small scripting change to have the script tell you who is available to follow.  Then you could just pick a name from the list and go.

Link to comment
Share on other sites

You need to spell the name correctly.

The last name is "Resident" and not "resident" - my bad.

In my scripts i dont care because I transform names read by notecards or typed in manually into usernames.

string username(string legacyname) {    return llDumpList2String (llParseString2List(llToLower(legacyname) + " ", [" resident ", " "],[]), ".");}

So the capitalization and resident or not doesnt matter. Everything goes on a notecard. You only need to spell it right.

llSensor can be used with usernames by setting AGENT_BY_USERNAME as the type parameter.

The script you posted is for a follower - an object. I don't know what tests you make but if you test things in an attachment keep in mind. An attachment can not detect it's wearer.

Link to comment
Share on other sites

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