Perl Script to LUA Script
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Perl Script to LUA Script

Started by fireball, 29 January, 2004, 20:41:35

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fireball

Hi, I run Open DC Hub for linux, and the other person in my network uses that ptokta hub which uses the lua scripting, well, i was searching everywhere for a lua programming guide, something that tells me all the commands, but with no luck... i kept getting here....

Well, this is the perl script... if anyone can help me out that would be great...

#!/usr/bin/perl -w
# For more information http://aatraders.port5.com/
# Purpose to display a unique login message for each person, administered by a
# forum modification!
# Change log Version - Name - YYYY MM DD
# 0.0.0.3a - A4 - 2003 09 21
#  - Now supports admin_op, ops as well as regs
# 0.0.0.2a - A4 - 2003 09 19
#  - Creating a local cache to increase speed, and decrease internet usage!
#  - Added possibility of On/Off switches
# 0.0.0.1a - A4 - 2003 09 17
#  - Actually connected it to the forums!
# 0.0.0.1 - A4 - 2003 09 ??
#  - Though about it, soved together a simple file!

use LWP::Simple;

$version = "0.0.0.3a";
$botname = "LoginBot";
$commandlinemode = "0";
%localcache = ();
$onoffswitch = 1; # 1 = on everything or else is off!
$localcacheonly = 0; # 1 = only use local cache copies
$noresetcache = 0; # 1 = disallows resetting of cache, should only be used when
      # you are low on bandwidth or you have the $localcacheonly on!
$forumaddy = "http://members.lycos.co.uk/aatraders/phpBB2/";
$forummod = "loginmsg.php?user=";


# Values:
# - 0 = Disabled
# - 1 = testing array and perl regular expressions
# - 2 = testing perl LWP::Simple

if ($commandlinemode eq "1")
{
  $_ = " hi, he, ho";
  @hhh = split(/\ /,$_);
  print $hhh[0];
}

if ($commandlinemode eq "2")
{
}

sub main()
{
  publicsay("$botname $version loaded!");
}

sub op_admin_connected
{
  my($user) = @_;
  if ($onoffswitch == 1)
  {
    say_login_message($user);
  }
}

sub op_connected
{
  my($user) = @_;
  if ($onoffswitch == 1)
  {
    say_login_message($user);
  }
}

sub reg_user_connected
{
  my($user) = @_;
  if ($onoffswitch == 1)
  {
    say_login_message($user);
  }
}

sub get_login_message
{
  my ($user) = @_;
  if (($localcache{$user} eq "") && ($localcacheonly == 0))
  {
    $_ = get($forumaddy.$forummod.$user);
    /\|/s;
    $localcache{$user} = $_;
  }
  return $localcache{$user};
}

sub say_login_message
{
  my ($user) = @_;
  publicsay(get_login_message($user));
}

sub data_arrival
{
  my ($user, $data) = @_;
  my (@command) = split(/\ /,$data);
  if ($#command < 0) {exit;};
  if ($command[0] =~ /^\  {
    if ($command[1] =~ /^-nani|-help|-nani\ loginbot$/i)
    {
      privatesay($user,"Please visit our forums (private message the nanibot".
   " with the word -forums for more details) to change your name!");
      privatesay($user,"-clearmycache ----- removes your cache from the ".
        "$botname you would use this if you changed your hub login message!");
    } elsif ($command[1] =~ /^\-clearmycache$/i)
    {
      if ($noresetcache == 0)
      {
        privatesay($user, "Clearing your cache!");
        $localcache{$user} = "";
      } else
      {
        privatesay($user, "Reseting of Local Cache is currently off!");
      }
    }
  } else { # we have command!
  }
}

sub publicsay
{
  my ($data) = @_;
  odch::data_to_all("<$botname> $data|");
}

sub privatesay
{
  my ($user, $data) = @_;
  odch::data_to_user($user, "<$botname> $data|");
}

well, like i said, any help with this would be great... thanks

you can also reach me on AIM (tylersreed) and MSN (tylersreed@msn.com)
--// FireBall //--
Lost Network -> http://lostnetwork.no-ip.com

VidFamne

>>HERE<< is the lua manual. Have fun. ;))

plop

and here you can follow a thread about how 2 make a bot like this.
just not by using a forum for changing but the bot itself.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

SMF spam blocked by CleanTalk