Tele-search v2

Other plugins for extending OpenKore's functionality. This forum is only for posting new plugins and commenting on existing plugins. For support, use the Support forum.

Moderator: Moderators

Message
Author
jones2323
Human
Human
Posts: 26
Joined: 07 Apr 2008, 02:55
Noob?: Yes
Location: Under the bridge

Tele-search v2

#1 Post by jones2323 »

[admin edit = "bibian"]
This plugin requires that you run the 2.0.6.1 version of Openkore OR SVN
Don't know what SVN is? read: http://www.openkore.com/wiki/index.php/What_is_SVN%3F
[/admin]

POSTED BY BIBIAN
tested on 2.0.5.1
Openkore 1.9.3 (SVN) or above required

Plugin is tested and should work just fine, if any bugs or weird scenario's emerge. Let me know Wink
Make sure you DO NOT have the other tele-search plugin installed!

I made this plugin to tackle a few bugs the old teleport search plugin has and to update / clean the code a bit.

Add to config.txt:
teleport_search, set to 1 to activate.
teleport_search_minSp, whats the min SP the char should have to teleport?

-- Will only check for SP if teleportAuto_useSkill is set to 1 (will NOT work if its set to 2 or 3, that requires too much code)

Add to timeouts.txt:
ai_teleport_search 5.
This number specifies how long we should walk around till we teleport to search for other targets.

Get the plugin here:
http://openkore.svn.sourceforge.net/vie ... arch-v2.pl

Or use TortoiseSVN to do a checkout / update
ORIGINAL POST
Image

iamanoob
Plain Yogurt
Plain Yogurt
Posts: 82
Joined: 04 Apr 2008, 09:49

Re: Tele-search v2

#2 Post by iamanoob »

Commit by bibian :: r6376 /plugins/trunk/tele-search-v2.pl:
Improved SP / Flywing checking method. Now also checks if you actually have fwings in your inventory.

Code: Select all

#########################################################################
#  OpenKore - Telesearch Plugin v2
#  Copyright (c) 2006 ViVi
#
# This plugin is licensed under Creative Commons "Attribution-NonCommercial-ShareAlike 2.5"
#
# You are free:
#    * to copy, distribute, display, and perform the work
#    * to make derivative works
# 
# Under the following conditions:
#    * by Attribution: You must attribute the work in the manner specified by the author or licensor.
#    * Noncommercial: You may not use this work for commercial purposes.
#    * Share Alike: If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one.
#
#    * For any reuse or distribution, you must make clear to others the license terms of this work.
#    * Any of these conditions can be waived if you get permission from the copyright holder.
#
# Your fair use and other rights are in no way affected by the above.
#
# This is a human-readable summary of the Legal Code ( Full License: http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode ). 
# Disclaimer: http://creativecommons.org/licenses/disclaimer-popup?lang=en
# 
#########################################################################
package telesearchV2;

use strict;
use Plugins;
use Settings;
use Log qw(message error);
use Utils;
use AI;
use Globals;

Plugins::register('Tele-Search v2', 'Alternative tele-search v2.', \&unload);
my $hooks = Plugins::addHooks(
	['AI_pre',\&search, undef],
	['map_loaded', \&MapLoaded, undef],
	['packet/sendMapLoaded', \&MapLoaded, undef],
);

my ($maploaded,$allow_tele);

# Set $maploaded to 1, this incase we reload the plugin for whatever reason...
if ($net && $net->getState() == Network::IN_GAME) {
	$maploaded = 1;
}

sub unload {
    Plugins::delHooks($hooks);
	message("Unloaded Teleport search v2.\n","info");
}
	   
sub MapLoaded {
	$maploaded = 1;
}

sub checkIdle {
	if (AI::action eq "move" && AI::action(1) eq "route" || AI::action eq "route" && !AI::inQueue("attack","skill_use")) {
		return 1;
	} else {
		return 0;
	}
}

sub canTeleport {
	$config{'teleport_search_minSp'} = 10 if (!$config{'teleport_search_minSp'});
	my $item = InventoryList::InventoryList->getByName("Fly Wing");
	
	if ((!$config{'teleportAuto_useSkill'} && $item) || # Using flywings
		($config{'teleportAuto_useSkill'} > 1) || # Using no SP for teleport
		($config{'teleportAuto_useSkill'} == 1 && $config{'teleport_search_minSp'} <= $char->{sp})) { # Using SP to teleport
		return 1;
	} else {
		return 0;
	}
}

sub search {
	if ($config{'teleport_search'} && Misc::inLockMap() && $timeout{'ai_teleport_search'}{'timeout'}) {
		
		if ($maploaded && !$allow_tele)  {
			$timeout{'ai_teleport_search'}{'time'} = time;
			$allow_tele = 1;
                        
		# Check if we're allowed to teleport, if map is loaded, timeout has passed and we're just looking for targets.
		} elsif ($maploaded && $allow_tele && timeOut($timeout{'ai_teleport_search'}) && checkIdle() && canTeleport()) {
			message("Attemping to tele-search.\n","info");
			$allow_tele = 0;
			$maploaded = 0;
			# Attempt to teleport, give error and unload plugin if we cant.
			if (!Misc::useTeleport(1)) {
				error ("Unable to tele-search cause we can't teleport!\n");
				return;
			} 

		# We're doing something else besides looking for monsters, reset the timeout.
		} elsif (!checkIdle()) {
			$timeout{'ai_teleport_search'}{'time'} = time;
		}
		
        # Oops! timeouts.txt is missing a crucial value, lets use the default value ;)
        } elsif (!$timeout{'ai_teleport_search'}{'timeout'}) {
			error ("timeouts.txt missing setting! Using default timeout of 5 seconds.\n");
			$timeout{'ai_teleport_search'}{'timeout'} = 5;
			return;
        }
}

return 1;
this was in http://openkore.svn.sourceforge.net/vie ... arch-v2.pl
ive edited this...

Code: Select all

my $item = InventoryList::InventoryList->getByName("Fly Wing");
to

Code: Select all

my $item = $char->inventory->getByName("Fly Wing");
InventoryList::InventoryList->getByName("Fly Wing"); i dont know why
but maybe it just errors only for me
but if some got this also
make a copy of your telesearchplugin (in case my edited code also crash)
this is the edited code...

Code: Select all

#########################################################################
#  OpenKore - Telesearch Plugin v2
#  Copyright (c) 2006 ViVi
#
# This plugin is licensed under Creative Commons "Attribution-NonCommercial-ShareAlike 2.5"
#
# You are free:
#    * to copy, distribute, display, and perform the work
#    * to make derivative works
# 
# Under the following conditions:
#    * by Attribution: You must attribute the work in the manner specified by the author or licensor.
#    * Noncommercial: You may not use this work for commercial purposes.
#    * Share Alike: If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one.
#
#    * For any reuse or distribution, you must make clear to others the license terms of this work.
#    * Any of these conditions can be waived if you get permission from the copyright holder.
#
# Your fair use and other rights are in no way affected by the above.
#
# This is a human-readable summary of the Legal Code ( Full License: http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode ). 
# Disclaimer: http://creativecommons.org/licenses/disclaimer-popup?lang=en
# 
#########################################################################
package telesearchV2;

use strict;
use Plugins;
use Settings;
use Log qw(message error);
use Utils;
use AI;
use Globals;

Plugins::register('Tele-Search v2', 'Alternative tele-search v2.', \&unload);
my $hooks = Plugins::addHooks(
	['AI_pre',\&search, undef],
	['map_loaded', \&MapLoaded, undef],
	['packet/sendMapLoaded', \&MapLoaded, undef],
);

my ($maploaded,$allow_tele);

# Set $maploaded to 1, this incase we reload the plugin for whatever reason...
if ($net && $net->getState() == Network::IN_GAME) {
	$maploaded = 1;
}

sub unload {
    Plugins::delHooks($hooks);
	message("Unloaded Teleport search v2.\n","info");
}
	   
sub MapLoaded {
	$maploaded = 1;
}

sub checkIdle {
	if (AI::action eq "move" && AI::action(1) eq "route" || AI::action eq "route" && !AI::inQueue("attack","skill_use")) {
		return 1;
	} else {
		return 0;
	}
}

sub canTeleport {
	$config{'teleport_search_minSp'} = 10 if (!$config{'teleport_search_minSp'});
	my $item = $char->inventory->getByName("Fly Wing");
	
	if ((!$config{'teleportAuto_useSkill'} && $item) || # Using flywings
		($config{'teleportAuto_useSkill'} > 1) || # Using no SP for teleport
		($config{'teleportAuto_useSkill'} == 1 && $config{'teleport_search_minSp'} <= $char->{sp})) { # Using SP to teleport
		return 1;
	} else {
		return 0;
	}
}

sub search {
	if ($config{'teleport_search'} && Misc::inLockMap() && $timeout{'ai_teleport_search'}{'timeout'}) {
		
		if ($maploaded && !$allow_tele)  {
			$timeout{'ai_teleport_search'}{'time'} = time;
			$allow_tele = 1;
                        
		# Check if we're allowed to teleport, if map is loaded, timeout has passed and we're just looking for targets.
		} elsif ($maploaded && $allow_tele && timeOut($timeout{'ai_teleport_search'}) && checkIdle() && canTeleport()) {
			message("Attemping to tele-search.\n","info");
			$allow_tele = 0;
			$maploaded = 0;
			# Attempt to teleport, give error and unload plugin if we cant.
			if (!Misc::useTeleport(1)) {
				error ("Unable to tele-search cause we can't teleport!\n");
				return;
			} 

		# We're doing something else besides looking for monsters, reset the timeout.
		} elsif (!checkIdle()) {
			$timeout{'ai_teleport_search'}{'time'} = time;
		}
		
        # Oops! timeouts.txt is missing a crucial value, lets use the default value ;)
        } elsif (!$timeout{'ai_teleport_search'}{'timeout'}) {
			error ("timeouts.txt missing setting! Using default timeout of 5 seconds.\n");
			$timeout{'ai_teleport_search'}{'timeout'} = 5;
			return;
        }
}

return 1;
Image
DARKest Ninja

iamanoob
Plain Yogurt
Plain Yogurt
Posts: 82
Joined: 04 Apr 2008, 09:49

Re: Tele-search v2

#3 Post by iamanoob »

or maybe do this
change

Code: Select all

if ((!$config{'teleportAuto_useSkill'} && $item) || # Using flywings
to this...

Code: Select all

if ((!$config{'teleportAuto_useSkill'} && $item->{amount} > 1) || # Using flywings
so it would not use up all your fly wings and leave a piece in inventory (incase for index)
[11:12 01/05] [GM] Some botters actually pm's us to see if we're active
[11:12 01/05] [GM] before they bot
[11:12 01/05] [GM] note that our bot hunters are very active
[11:12 01/05] [GM] even if you do pm us, they have "unknown" chars to take down
[11:13 01/05] [GM] botters
[11:13 01/05] [GM] Botting will get you nowhere. Time to give up on it...
[11:13 01/05] [GM] only ban and wasting time
[11:13 01/05] [GM] So thanks for your time. Keep Voting aero (and nicole)
:lol:
Image
DARKest Ninja

Bibian
Perl Monk
Perl Monk
Posts: 416
Joined: 04 Apr 2008, 03:08

Re: Tele-search v2

#4 Post by Bibian »

If you're running SVN there is no need to edit the code afaik...

Code: Select all

my $item = InventoryList::InventoryList->getByName("Fly Wing");
Will return undef to $item if no such item exists according to the documentation
In theory my code should work fine, there's no need to use the %char hash, though i havent tested it cause i dont tele-search with flywings myself

Dareniel92
Noob
Noob
Posts: 2
Joined: 06 Jun 2008, 11:17
Noob?: Yes

Re: Tele-search v2

#5 Post by Dareniel92 »

Error :-

Can't locate object method "getByName" via package "InventoryList::InventoryList" (perhaps you forgot to load "InventoryList::InventoryList"?) at D:/openkore-2.0.5.1/plugins/tele-search-v2.pl line 68.
at D:/openkore-2.0.5.1/plugins/tele-search-v2.pl line 68
telesearchV2::canTeleport() called at D:/openkore-2.0.5.1/plugins/tele-search-v2.pl line 82
telesearchV2::search('AI_pre', 'undef', 'undef') called at src/Plugins.pm line 415
Plugins::callHook('AI_pre') called at src/AI/CoreLogic.pm line 111
AI::CoreLogic::iterate() called at src/functions.pl line 593
main::mainLoop_initialized() called at src/functions.pl line 70
main::mainLoop() called at src/Interface.pm line 75
Interface::mainLoop('Interface::Console::Win32=HASH(0x2390c78)') called at openkore.pl line 96
main::__start() called at start.pl line 125



How to fix it

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: Tele-search v2

#6 Post by Technology »

@Dareniel92

Read the posts above yours. You are not using SVN version, so you need to edit the plugin.
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!

Cozzie
Spam Generator
Spam Generator
Posts: 499
Joined: 04 Apr 2008, 09:30
Noob?: No
Location: Melbourne, City of beer and awful sushis

Re: Tele-search v2

#7 Post by Cozzie »

same error but in r6391.

Code: Select all

OpenKore version what-will-become-2.0.6 (SVN version)
@ai_seq = route
Network state = 5
Network handler = Network::DirectConnection
SVN revision: 6391
Loaded plugins:
  plugins/macro.pl (macro)
  plugins/teleSearchv2.pl (Tele-Search v2)

Error message:
Can't locate object method "getByName" via package "InventoryList::InventoryList" (perhaps you forgot to load "InventoryList::InventoryList"?) at C:/Users/Cozzie/Desktop/openkore_ready/plugins/teleSearchv2.pl line 68.

Stack trace:
Can't locate object method "getByName" via package "InventoryList::InventoryList" (perhaps you forgot to load "InventoryList::InventoryList"?) at C:/Users/Cozzie/Desktop/openkore_ready/plugins/teleSearchv2.pl line 68.
 at C:/Users/Cozzie/Desktop/openkore_ready/plugins/teleSearchv2.pl line 68
	telesearchV2::canTeleport() called at C:/Users/Cozzie/Desktop/openkore_ready/plugins/teleSearchv2.pl line 82
	telesearchV2::search('AI_pre', 'undef', 'undef') called at src/Plugins.pm line 415
	Plugins::callHook('AI_pre') called at src/AI/CoreLogic.pm line 112
	AI::CoreLogic::iterate() called at src/functions.pl line 593
	main::mainLoop_initialized() called at src/functions.pl line 70
	main::mainLoop() called at src/Interface.pm line 75
	Interface::mainLoop('Interface::Console::Win32=HASH(0x29dc5dc)') called at openkore.pl line 96
	main::__start() called at start.pl line 119

Died at this line:
  	$config{'teleport_search_minSp'} = 10 if (!$config{'teleport_search_minSp'});
* 	my $item = InventoryList::InventoryList->getByName("Fly Wing");
  	

errors.txt while using iamnoob's edit. I believe it's the same but i could have missed something.

Code: Select all

OpenKore version what-will-become-2.0.6 (SVN version)
@ai_seq = route
Network state = 5
Network handler = Network::DirectConnection
SVN revision: 6391
Loaded plugins:
  plugins/macro.pl (macro)
  plugins/teleSearchv2.pl (Tele-Search v2)

Error message:
Can't locate object method "getByName" via package "InventoryList::InventoryList" (perhaps you forgot to load "InventoryList::InventoryList"?) at C:/Users/Cozzie/Desktop/openkore_ready/plugins/teleSearchv2.pl line 68.

Stack trace:
Can't locate object method "getByName" via package "InventoryList::InventoryList" (perhaps you forgot to load "InventoryList::InventoryList"?) at C:/Users/Cozzie/Desktop/openkore_ready/plugins/teleSearchv2.pl line 68.
 at C:/Users/Cozzie/Desktop/openkore_ready/plugins/teleSearchv2.pl line 68
	telesearchV2::canTeleport() called at C:/Users/Cozzie/Desktop/openkore_ready/plugins/teleSearchv2.pl line 82
	telesearchV2::search('AI_pre', 'undef', 'undef') called at src/Plugins.pm line 415
	Plugins::callHook('AI_pre') called at src/AI/CoreLogic.pm line 112
	AI::CoreLogic::iterate() called at src/functions.pl line 593
	main::mainLoop_initialized() called at src/functions.pl line 70
	main::mainLoop() called at src/Interface.pm line 75
	Interface::mainLoop('Interface::Console::Win32=HASH(0x29dc5dc)') called at openkore.pl line 96
	main::__start() called at start.pl line 119

Died at this line:
  	$config{'teleport_search_minSp'} = 10 if (!$config{'teleport_search_minSp'});
* 	my $item = InventoryList::InventoryList->getByName("Fly Wing");
  	

Make Openkore Awesome. Join the team.

iamanoob
Plain Yogurt
Plain Yogurt
Posts: 82
Joined: 04 Apr 2008, 09:49

Re: Tele-search v2

#8 Post by iamanoob »

Code: Select all

my $item = $char->inventory->getByName("Fly Wing");
line 68
but i dont use this plugin,
i just make my own plugin like this XD
Image
DARKest Ninja

Cozzie
Spam Generator
Spam Generator
Posts: 499
Joined: 04 Apr 2008, 09:30
Noob?: No
Location: Melbourne, City of beer and awful sushis

Re: Tele-search v2

#9 Post by Cozzie »

yeah already edited that and still shows error.
Make Openkore Awesome. Join the team.

hakore
Super Moderators
Super Moderators
Posts: 214
Joined: 16 May 2008, 08:28
Noob?: No
Contact:

Re: Tele-search v2

#10 Post by hakore »

Cozzie, you didn't. Look at the error log again... it shows the same code, unedited. Both plugin have the InventoryList::InventoryList crap.
Whatever...

Post Reply