EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Custom (https://www.eqemulator.org/forums/forumdisplay.php?f=671)
-   -   goto (playername) (https://www.eqemulator.org/forums/showthread.php?t=28917)

Capheus 07-16-2009 09:06 AM

goto (playername)
 
Another one I put on my bot. This will move you to any player in the zone.

Code:


#goto (playername)

sub EVENT_SAY {

 if($text=~/goto/i){
  $here = 0;
  $mee = $client;
  $zid = $zoneid;
  @word = split /\s+/, $text;
  $go = $word[1];
  quest::say("Looking for $go...");
  my $list_check = 0;

  for ($list_check = 0; $list_check < 2000; $list_check++) {

  $client_search = $entity_list->GetClientByID($list_check);

  if ($client_search) {
    my $cx = int($client_search->GetX());
    my $cy = int($client_search->GetY());
    my $cz = int($client_search->GetZ());
    $person = $client_search->GetCleanName();

    if ($person =~ /$go/i) {
    $mee->MovePC($zid,$cx,$cy,$cz,0);
    $here = 1;
  }
  }
    }

  if ($here == 0) {
  quest::say("I can't find $go. He/She may not be in the zone anymore.");
  }

 }
}


Derision 07-16-2009 09:32 AM

You should be able to use $entity_list->GetClientByName($go) rather than looping like that, or at least use 'last' to break out of the loop once you find a player name that matches.

Capheus 07-16-2009 01:39 PM

Wow can't believe I missed that one, thanks a lot! shortened version here.

Code:

sub EVENT_SAY {

 if($text=~/goto/i){
  $mee = $client;
  $zid = $zoneid;
  @word = split /\s+/, $text;
  $go = $word[1];
  quest::say("Looking for $go...");
  $client_search = $entity_list->GetClientByName($go);

  if ($client_search) {
  my $cx = int($client_search->GetX());
  my $cy = int($client_search->GetY());
  my $cz = int($client_search->GetZ());
  $mee->MovePC($zid,$cx,$cy,$cz,0);
  }

  else {
    quest::say("I can't find $go. He/She may not be in the zone anymore.");
  }
 
 }
}


drzoyburg 07-24-2009 11:52 AM

Where did you insert this to make this work?

Doc

Capheus 07-24-2009 11:59 PM

If you want to make it work on your bot in all zones you will need to name it as botname.pl and save it in the .../quests/templates directory. If you didn't already know, the templates templates directory acts as all zones for quests and scripts. Using npctypeidnumber.pl doesn't seem to work, it has to be name.pl


All times are GMT -4. The time now is 12:33 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.