Xchat Perl Scripting: IF Event Halt

Discussion about Perl, TCL or Python scripts and C/C++ plugins (using and writing them).

Xchat Perl Scripting

Postby XchatLover » 30 Mar 2009 14:12

I made a script in perl and it includes the following code:

Code: Select all
sub sapp {
   if ($script eq "on") {
      Xchat::print("Script is off");
   if ($script eq "off") {
      Xchat::print("Script is on ");

When I type /sapp the script turns off and then automatically on.
How can I halt the event so it will work?
Posts: 1
Joined: 30 Mar 2009 14:06

Postby LifeIsPain » 30 Mar 2009 17:54

including that small section really isn't enough to know what you need. Assuming that $script is defined at a higher level of the scope (as in a global for that script) then just place an if ($script eq "on") { } wherever you want to check to see if something should be run.

That said, the second if would logically either be an elsif, or just an else with now conditional evaluation.
User avatar
Posts: 522
Joined: 25 Aug 2005 06:36

Return to Scripts and Plugins

Who is online

Users browsing this forum: No registered users and 0 guests