Page 1 of 1

Profiles Selector

Posted: 05 Apr 2008, 05:04
by d3fc0n
working on SVN 2.0.5

don't need any batch files !!

support files
  • config
    items_control
    mon_control
    shop
profiles folder structure.
openkore
|-control
|-fields
|-plugins
|-profiles
| |-default
| |-another
| |-other
|-src
|-tables
profiles.pl

Code: Select all

#########################################################################
# This software is open source, licensed under the GNU General Public
# License, version 2.
# Basically, this means that you're allowed to modify and distribute
# this software. However, if you distribute modified versions, you MUST
# also distribute the source code.
# See http://www.gnu.org/licenses/gpl.html for the full license.
#########################################################################
# profiles selector (full)
# d3fc0n 30/12/2007
#########################################################################

package profiles;

use strict;
use Plugins;
use Globals qw($interface);

my $profile_folder = "profiles";

Plugins::register('profiles', 'Profiles Selector', \&on_unload);

my $hooks = Plugins::addHooks(
		['start', \&onStart]
	);

sub on_unload {
	Plugins::delHook($hooks);
	undef $profile_folder;
}

sub onStart {
	opendir D, $profile_folder;
	my @conlist = readdir(D);
	closedir D;

	my @profiles;

	foreach (@conlist) {
		next if (!-d "$profile_folder\\$_");
		next if ($_ =~ /^\./);
		push @profiles, $_;
	}

	my $choice = $interface->showMenu(
			"Please choose a Profiles folder.",
			\@profiles,
			title => "Profiles Selector"
		);

	if ($choice == -1) {
		exit;

	} else {

		if (-e "$profile_folder\\" . @profiles[$choice] . "\\config.txt") {
			$Settings::config_file = "$profile_folder\\" . @profiles[$choice] . "\\config.txt";
		}

		if (-e "$profile_folder\\" . @profiles[$choice] . "\\mon_control.txt") {
			$Settings::mon_control_file = "$profile_folder\\" . @profiles[$choice] . "\\mon_control.txt";
		}

		if (-e "$profile_folder\\" . @profiles[$choice] . "\\items_control.txt") {
			$Settings::items_control_file = "$profile_folder\\" . @profiles[$choice] . "\\items_control.txt";
		}

		if (-e "$profile_folder\\" . @profiles[$choice] . "\\shop.txt") {
			$Settings::shop_file = "$profile_folder\\" . @profiles[$choice] . "\\shop.txt";
		}
	}
}

return 1;

Re: Profiles Selector

Posted: 08 Apr 2008, 23:37
by acemg
OK i will elaborate more further, since i coudnt make it to work i would appreciate if you give out comments and advise, heres the screenie

Image
Image


i just need some advise

Re: Profiles Selector

Posted: 11 Apr 2008, 00:04
by d3fc0n
just wrong folder structure.

Re: Profiles Selector

Posted: 13 Apr 2008, 20:19
by acemg
IMHO, timeout.txt should be supported as well.

Re: Profiles Selector

Posted: 14 Apr 2008, 12:21
by lacunacoil
Great plugin dude!
But man , your first SS is confusing everybody it made me believe that the profiles folder should be placed inside plugins folder.

PEOPLE PROFILE FOLDER MUST BE PLACES IN YOUR OPENKORE MAIN FOLDER OTHERWISE IT WONT WORK!

Re: Profiles Selector

Posted: 14 Apr 2008, 13:11
by lacunacoil
Btw can someone change it so it would automatically change timeouts and pickupitems also?
I've tryed but it didin't work I wonder why

Re: Profiles Selector

Posted: 01 Dec 2010, 04:27
by gelo32k
I'm very sorry for resurrecting this old topic, but I grew fond on using this plugin to organize my bot...

Can somebody fix this plug in to work with the latest SVN version? :D

or... a good alternative plugin will do ^_^

Re: Profiles Selector

Posted: 27 Oct 2011, 17:42
by EternalHarvest
Added to svn: http://openkore.svn.sourceforge.net/vie ... l?view=log

Now overlays the whole control directory with profile directory (any files from control may be redefined), works with current trunk.