Openkore.com

OpenKore Forums
It is currently 20 Nov 2018, 03:54

All times are UTC - 5 hours [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Macro Mods
PostPosted: 24 Dec 2008, 04:33 
Offline
Human
Human
User avatar

Joined: 15 Apr 2008, 06:08
Posts: 39
Location: Russia, Velikiy Novgorod
Oops, :) Prompt development

_________________
[rofan.ru team] Image
https://sourceforge.net/users/lastclick/


Top
 Profile  
 
 Post subject: Re: Macro Mods
PostPosted: 27 Jul 2009, 17:51 
Offline
Super Moderators
Super Moderators
User avatar

Joined: 06 May 2008, 12:47
Posts: 801
Someone linked me to this on IRC:
Can someone please take a look at it?

original source

Quote:
For Macro v. 2.0.3-svn (27/7/52)

- add @ Npc(</regexp/i or "name">) for find npc by name (return binID)
becuz some server random position [can't find by @npc(xx yy)]




file ../plugins/Macro/Data.pm
find:
Code:
   "npc"      . "|" .

replace with:
Code:
   "[Nn]pc"      . "|" .



file ../plugins/Macro/Data.pm
find:
Code:
use Macro::Utilities qw(refreshGlobal getnpcID getItemIDs getItemPrice getStorageIDs getInventoryIDs
   getPlayerID getVenderID getRandom getRandomRange getInventoryAmount getCartAmount getShopAmount
   getStorageAmount getVendAmount getConfig getWord q4rx q4rx2 getArgFromList getListLenght);

replace with:
Code:
use Macro::Utilities qw(refreshGlobal getnpcID getnpcIDfromName getItemIDs getItemPrice getStorageIDs getInventoryIDs
   getPlayerID getVenderID getRandom getRandomRange getInventoryAmount getCartAmount getShopAmount
   getStorageAmount getVendAmount getConfig getWord q4rx q4rx2 getArgFromList getListLenght);


find:
Code:
   if ($kw eq 'npc')         {$ret = getnpcID($arg)}
      elsif ($kw eq 'cart')      {($ret) = getItemIDs($arg, $::cart{'inventory'})}

replace with:
Code:
      if ($kw eq 'npc')         {$ret = getnpcID($arg)}
      elsif ($kw eq 'Npc')      {$ret = getnpcIDfromName($arg)}
      elsif ($kw eq 'cart')      {($ret) = getItemIDs($arg, $::cart{'inventory'})}


file ../plugins/Macro/Utilities.pm
find:
Code:
our @EXPORT_OK = qw(ai_isIdle q4rx q4rx2 between cmpr match getArgs refreshGlobal getnpcID getPlayerID
   getVenderID getItemIDs getItemPrice getInventoryIDs getStorageIDs getSoldOut getInventoryAmount
   getCartAmount getShopAmount getStorageAmount getVendAmount getRandom getRandomRange getConfig
   getWord callMacro getArgFromList getListLenght sameParty);

replace with:
Code:
our @EXPORT_OK = qw(ai_isIdle q4rx q4rx2 between cmpr match getArgs refreshGlobal getnpcID getnpcIDfromName getPlayerID
   getVenderID getItemIDs getItemPrice getInventoryIDs getStorageIDs getSoldOut getInventoryAmount
   getCartAmount getShopAmount getStorageAmount getVendAmount getRandom getRandomRange getConfig
   getWord callMacro getArgFromList getListLenght sameParty);


find:
Code:
use Macro::Data

add after:
Code:
use Network;


find:
Code:
sub getnpcID {
   my ($tmpx, $tmpy) = split(/ /,$_[0]);
   foreach my $npc (@{$npcsList->getItems()}) {
      return $npc->{binID} if ($npc->{pos}{x} == $tmpx && $npc->{pos}{y} == $tmpy)
   }
   return -1
}

add after:
Code:
sub getnpcIDfromName {
   my $nameNPC = $_[0];
   foreach my $npc (@{$npcsList->getItems()}) {
     if(my($re, $ci) = $nameNPC =~ /^\/(.+?)\/(i?)$/){
      if(($ci && $npc->{name} =~ /$re/i) || (!$ci && $npc->{name} =~ /$re/)){
        return $npc->{binID}
      }
     }elsif($nameNPC =~ /^"(.*?)"$/){
        return $npc->{binID} if $npc->{name} eq $1
     }
   }
   return -1
}

_________________
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!


Top
 Profile  
 
 Post subject: Re: Macro Mods
PostPosted: 06 Aug 2009, 11:33 
Offline
Developers
Developers
User avatar

Joined: 04 Apr 2008, 09:50
Posts: 109
Done it already with different approach. http://forums.openkore.com/viewtopic.php?f=32&t=6784

_________________
An Overall Macro Plugins Diffs Proposal


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group