Hide Console plugin

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
hiltz2
Noob
Noob
Posts: 1
Joined: 03 May 2008, 04:59
Noob?: Yes

Re: Hide Console plugin

#11 Post by hiltz2 »

kingkevz wrote:

Code: Select all

# =======================
# hideConsole v1.0
# =======================
# by hakore (hakore@users.sourceforge.net)
# see documentation at: http://forums.openkore.com/viewtopic.php?p=103437

package hideConsole;

use Globals qw(%config $interface);
use Log qw(message error);

if ($Settings::interface ne "Console") {
        message("The hideConsole plugin only works with the Console interface.\n");
        return 1;
}

Plugins::register('hideConsole', 'hide your console', \&onUnload);

my $hooks = Plugins::addHooks(
        ['initialized', \&autoHideConsole, undef],
        ['Command_post', \&cmdhideConsole, undef]
);

sub onUnload {
        Plugins::delHooks($hooks);
}

sub autoHideConsole {
        if ($config{hideConsole} > 0) {
                message("Auto-hiding console in $config{hideConsole} seconds...\n");
                message("Hide the console? (Y/n) ");

                my $msg = $interface->getInput($config{hideConsole});
                if ($msg =~ /y/i || $msg eq "") {
                        message("Console hidden\n\n");
                        hideConsole();
                } else {
                        message("Cancelled auto-hide of console\n\n");
                }
        }
}

sub cmdhideConsole {
        my (undef, $args) = @_;
        my ($cmd) = split(' ', $args->{input}, 2);
        if ($cmd eq "hideconsole") {
                message("Console hidden\n\n");
                hideConsole();
                $args->{return} = 1;
        }
}

sub hideConsole {
        eval 'use Win32::Console;Win32::Console->new(STD_OUTPUT_HANDLE)->Free();';
}

return 1;
Where should I save this? I mean, what should I name the file? And does this work in 1.9.3?

I'm a noob. Sorry.

janamigs
Noob
Noob
Posts: 3
Joined: 18 Apr 2008, 17:43

Re: Hide Console plugin

#12 Post by janamigs »

what if, i have something to type before the openkore auto-hides?
for example, everytime i run my Bot i type in the word 'c @autoloot 20'
then how can i make it hide after i type it?

kingkevz
Human
Human
Posts: 25
Joined: 04 Apr 2008, 22:55

Re: Hide Console plugin

#13 Post by kingkevz »

use a macro

RBiN
Noob
Noob
Posts: 12
Joined: 07 Apr 2008, 03:31

Re: Hide Console plugin

#14 Post by RBiN »

you can do that w/o the use of a macro. try to change the ff.

Code: Select all

-use Globals qw(%config $interface);
+use Globals qw(%config $interface $messageSender);

   my $msg = $interface->getInput($config{hideConsole});
                if ($msg =~ /y/i || $msg eq "") {
                        message("Console hidden\n\n");
+                       sendMessage($messageSender, "c", "@autoloot 20");
                        hideConsole();

   if ($cmd eq "hideconsole") {
                message("Console hidden\n\n");
+               sendMessage($messageSender, "c", "@autoloot 20");
                hideConsole();
- means ommit + means add
g'luck

heerojsn
Noob
Noob
Posts: 4
Joined: 19 Apr 2008, 01:22

Re: Hide Console plugin

#15 Post by heerojsn »

can anyone give us a config.txt with an autohide console

fco2783
Plain Yogurt
Plain Yogurt
Posts: 95
Joined: 05 Apr 2008, 05:15
Noob?: Yes
Location: in place where you cant go
Contact:

Re: Hide Console plugin

#16 Post by fco2783 »

put this on your config.txt

Code: Select all

hideConsole 1

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

Re: Hide Console plugin

#17 Post by iamanoob »

heerojsn wrote:can anyone give us a config.txt with an autohide console
@fco2783 heerojsn meant to hide his WX
@heerojsn now you can :D

you could either do this
http://forums.openkore.com/viewtopic.php?f=34&t=826
http://forums.openkore.com/viewtopic.php?f=34&t=836

or this
http://forums.openkore.com/viewtopic.php?f=34&t=826
http://forums.openkore.com/viewtopic.php?f=32&t=835
Image
DARKest Ninja

Dark Shadow
Noob
Noob
Posts: 1
Joined: 17 Nov 2008, 08:26
Noob?: Yes

Re: Hide Console plugin

#18 Post by Dark Shadow »

Can u pls tell me where to paste the auto hide plugin u have mentioned...
i have read...but i dunt understand where to use it
thanx... :|

snorlax
Noob
Noob
Posts: 2
Joined: 22 Nov 2008, 23:32
Noob?: Yes
Contact:

where i should input the code?

#19 Post by snorlax »

# =======================
# hideConsole v1.0
# =======================
# by hakore (hakore@users.sourceforge.net)
# see documentation at: http://forums.openkore.com/viewtopic.php?p=103437

package hideConsole;

use Globals qw(%config $interface);
use Log qw(message error);

if ($Settings::interface ne "Console") {
message("The hideConsole plugin only works with the Console interface.\n");
return 1;
}

Plugins::register('hideConsole', 'hide your console', \&onUnload);

my $hooks = Plugins::addHooks(
['initialized', \&autoHideConsole, undef],
['Command_post', \&cmdhideConsole, undef]
);

sub onUnload {
Plugins::delHooks($hooks);
}

sub autoHideConsole {
if ($config{hideConsole} > 0) {
message("Auto-hiding console in $config{hideConsole} seconds...\n");
message("Hide the console? (Y/n) ");

my $msg = $interface->getInput($config{hideConsole});
if ($msg =~ /y/i || $msg eq "") {
message("Console hidden\n\n");
hideConsole();
} else {
message("Cancelled auto-hide of console\n\n");
}
}
}

sub cmdhideConsole {
my (undef, $args) = @_;
my ($cmd) = split(' ', $args->{input}, 2);
if ($cmd eq "hideconsole") {
message("Console hidden\n\n");
hideConsole();
$args->{return} = 1;
}
}

sub hideConsole {
eval 'use Win32::Console;Win32::Console->new(STD_OUTPUT_HANDLE)->Free();';
}

return 1;

sli
Perl Monk
Perl Monk
Posts: 810
Joined: 04 Apr 2008, 17:26
Noob?: No

Re: Hide Console plugin

#20 Post by sli »

RBiN wrote:you can do that w/o the use of a macro. try to change the ff.

Code: Select all

-use Globals qw(%config $interface);
+use Globals qw(%config $interface $messageSender);

   my $msg = $interface->getInput($config{hideConsole});
                if ($msg =~ /y/i || $msg eq "") {
                        message("Console hidden\n\n");
+                       sendMessage($messageSender, "c", "@autoloot 20");
                        hideConsole();

   if ($cmd eq "hideconsole") {
                message("Console hidden\n\n");
+               sendMessage($messageSender, "c", "@autoloot 20");
                hideConsole();
- means ommit + means add
g'luck
Macros are meant for this kind of thing. Modifying a plugin to perform actions that something else could manage is bad form and shouldn't be done.
cs : ee : realist

Post Reply