• Home
  • Servers
  • Chat
  • Channels
  • Commands
  • Forum
  • FAQ
  • Software
  • Quotes
Topic Options
Rate This Topic
#5098 - 06/05/09 01:06 PM Need help with XChat away script
iAlex Offline
Over 100 posts

Registered: 09/01/08
Posts: 100
Loc: Kongsvinger, 2209 Norway.
Ok, so I've moved from mIRC to XChat, got perl loaded. And started modifying XChat a bit..
What I want is a script that when i type /iaway will:

Change my nick on [Banned-URL] to "Alex[Away]"
Send the message ".status away" to the channel #norway on [Banned-URL]
Change my nick on WyldRyde to "iAlex[Away]"

and when i type /iback will:

Change my nick on [Banned-URL] to "Alex"
Send the message ".status here" to the channel #norway on [Banned-URL]
Change my nick on WyldRyde to "iAlex"

I currently have this code:
Code:
#!/usr/bin/perl

### Xchat registers and hooks.

Xchat::register("Alex's away script", "1.0", "Alex's away script", "");
Xchat::hook_command("iaway", "setaway");
Xchat::hook_command("iback", "setback");

use warnings;
use strict;

### Main routine.


sub setaway {
  my $oldcontext = Xchat::get_context();
  my $curnet = "[Banned-URL]";
  Xchat::set_context("$curnet");
  Xchat::command("nick Alex[Away]");
  XChat::command("msg #norway .status away");
  $curnet = "WyldRyde";
  Xchat::set_context("$curnet");
  Xchat::command("nick iAlex[Away]");
}

sub setback {
  my $oldcontext = Xchat::get_context();
  my $curnet = "[Banned-URL]";
  Xchat::set_context("$curnet");
  Xchat::command("nick Alex");
  XChat::command("msg #norway .status here");
  $curnet = "WyldRyde";
  Xchat::set_context("$curnet");
  Xchat::command("nick iAlex");
}

It changes my nick to Alex[Away] and Alex on [Banned-URL], but does not perform any other operations. What am i doing wrong? please respond smile
_________________________
http://ialex.info
ialex94wr@gmail.com
alex@ialex.info

Top
Sponsored Links
Sponsored Links
Member
*****

Registered: 27/08/04
Posts: 10136
Loc: Mountain View, CA
Top
#5099 - 06/05/09 01:25 PM Re: Need help with XChat away script [Re: iAlex]
Phil Offline
Over 200 posts

Registered: 10/23/06
Posts: 205
Loc: Warwick, UK
msg isn't an IRC command.

Phil

Top
#5100 - 06/05/09 01:30 PM Re: Need help with XChat away script [Re: iAlex]
iAlex Offline
Over 100 posts

Registered: 09/01/08
Posts: 100
Loc: Kongsvinger, 2209 Norway.
Ok.. so now I have this.. but the same happens ;\
Code:
#!/usr/bin/perl

### Xchat registers and hooks.

Xchat::register("Alex's away script", "1.0", "Alex's away script", "");
Xchat::hook_command("iaway", "setaway");
Xchat::hook_command("iback", "setback");

use warnings;
use strict;

### Main routine.


sub setaway {
  my $oldcontext = Xchat::get_context();
  my $curnet = "[Banned-URL]";
  Xchat::set_context("$curnet");
  Xchat::command("NICK Alex[Away]");
  XChat::command("PRIVMSG #norway :.status away");
  $curnet = "WyldRyde";
  Xchat::set_context("$curnet");
  Xchat::command("NICK iAlex[Away]");
}

sub setback {
  my $oldcontext = Xchat::get_context();
  my $curnet = "[Banned-URL]";
  Xchat::set_context("$curnet");
  Xchat::command("NICK Alex");
  XChat::command("PRIVMSG #norway :.status here");
  $curnet = "WyldRyde";
  Xchat::set_context("$curnet");
  Xchat::command("NICK iAlex");
}
_________________________
http://ialex.info
ialex94wr@gmail.com
alex@ialex.info

Top
#5101 - 06/05/09 02:20 PM Re: Need help with XChat away script [Re: iAlex]
iAlex Offline
Over 100 posts

Registered: 09/01/08
Posts: 100
Loc: Kongsvinger, 2209 Norway.
ok gotten it working now smile
And i want to help Phil for the help smile
Code:
#!/usr/bin/perl

### Xchat registers and hooks.

Xchat::register("Alex's away script", "1.0", "Alex's away script", "");
Xchat::hook_command("iaway", "setaway");
Xchat::hook_command("iback", "setback");

use warnings;
use strict;

### Main routine.


sub setaway {
  Xchat::set_context("#norway", "[Banned-URL]");
  Xchat::command("NICK Alex[Away]");
  Xchat::command("MSG #Norway .status away");
  Xchat::set_context("#iphone", "WyldRyde");
  Xchat::command("NICK iAlex[Away]");
}

sub setback {
  Xchat::set_context("#norway", "[Banned-URL]");
  Xchat::command("NICK Alex");
  Xchat::command("MSG #Norway .status here");
  Xchat::set_context("#iphone", "WyldRyde");
  Xchat::command("NICK iAlex");
}
_________________________
http://ialex.info
ialex94wr@gmail.com
alex@ialex.info

Top


Moderator:  mandy