PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Ubikk on 21 December, 2004, 09:06:09

Title: need help from Plop
Post by: Ubikk on 21 December, 2004, 09:06:09
Hello there

I have downloaded a banner script from plop's website //www.plop.nl

This is the script:

Quote-- places a scrolling text in the bot's name.
-- looks nice but takes a lot of bandwidth.
-- plop


string = "   Welcome to Heaven   "
   

stringloop = string
length = 20
speed = 1300

function Main()
   SetTimer(speed)
   StartTimer()
   stringloop = gsub(stringloop, " ", " ")
end

function OnTimer()
   if T == nil then
      T = strsub(stringloop, 1, length)
      frmHub:RegBot("<  "..T.."  >")
   else
      frmHub:UnregBot("<  "..T.."  >")
      stringloop = strsub(stringloop, 2, -1)
      if strlen(stringloop) < length then
         stringloop = stringloop.." "..string
      end
      T = strsub(stringloop, 1, length)
      frmHub:RegBot("<  "..T.."  >")
   end
end

function OnExit()
   frmHub:UnregBot("<  "..T.."  >")
end

function DataArrival(user, data)
   if( strsub(data, 1, 1) == "<" ) then
      if user.iProfile == 0 then
         local s,e,cmd,onoff = strfind(data,"^%b<>%s+(%S+)%s*(%S*)")
         user:SendData(cmd)
         if cmd == "!restartscripts" then
            frmHub:UnregBot("-->"..T.."<--")
            StopTimer()
         elseif cmd == "!light" then
            user:SendData(onoff)
            if onoff == "on" then
               --SetTimer(speed)
               T = nil
               StartTimer()
               User:SendData(" started")
               return 1
            elseif onoff == "off" then
               StopTimer()
               frmHub:UnregBot("-->"..T.."<--")
               T = nil
               User:SendData(" stopped")
               return 1
            end
         end
      --else
         --user:SendData(" user level 2 low")
      end
   end
end


The scripts works fine but I've noticed a little bug while running it.

As long as the scripts runs, all the users that talk in the mainchat get an echo for each line they write or something like that. Here's an example:


[12:38] va
[12:38] va merge netu?
[12:38] <[Xana][dacia]ssir_kon> nuuuuuuuuuuuuuuuuuuuuu
[12:38] acuma
[12:38] acuma a picat?
[12:38] <[Xana][dacia]ssir_kon> da ce draq are
[12:39] mda
[12:39] mda
[12:39] astas
[12:39] astas e
[12:39] :)
[12:39] :)

I am the only one that can see my echo, but that doesnt make it less annoying. Can somebody help me, please? :(.

P.S: I'm 100% that this error is from that script ;)
Title:
Post by: plop on 21 December, 2004, 17:17:19
that was some left over debugging stuff.
i made this script just for the fun, the bandwidth usage is really high.
40KB/s upload from this script on 200 users.
-- places a scrolling text in the bot's name.
-- looks nice but takes a lot of bandwidth.
-- my advice is never 2 use this, i made it just for fun.
-- plop


string = "Pride, Porn ?n Prejudice. Come on folks the show begins. A movie full of whores ?n pimps. "..
   "Turn out the lights ?n start the reel. Check out who?s the imbecile. Come on folks just come right in. "..
   "To the weirdest place you?ve ever been. Get your tickets at the door. You?ve never seen such filth before. "..
   "Welcome! Welcome to the SINema. Welcome! Hey you kids, just dig around. Show the host what you just found. "..
   "Don?t you fear, just bring it in. There?s room enough in the house of sin. I don?t like the movie in this SINema. "..
   "I don?t like the movie in this SINema. I don?t like the movie. I don?t like the movie. I don?t like the movie in this SINema. "..
   "Where?s Stallone or Spiderman. I didn?t see this scene in Cannes. Where is Chan or Superman. Save us all? "..
   "Welcome, welcome to the SINema. Sit back, relax, enjoy the show! Welcome!"

stringloop = string
length = 20
speed = 500

function Main()
   SetTimer(speed)
   StartTimer()
   stringloop = gsub(stringloop, " ", "_")
end

function OnTimer()
   if T == nil then
      T = strsub(stringloop, 1, length)
      frmHub:RegBot("-->"..T.."<--")
   else
      frmHub:UnregBot("-->"..T.."<--")
      stringloop = strsub(stringloop, 2, -1)
      if strlen(stringloop) < length then
         stringloop = stringloop.." "..string
      end
      T = strsub(stringloop, 1, length)
      frmHub:RegBot("-->"..T.."<--")
   end
end

function OnExit()
   frmHub:UnregBot("-->"..T.."<--")
end

function DataArrival(user, data)
   if( strsub(data, 1, 1) == "<" ) then
      if user.iProfile == 0 then
         local s,e,cmd,onoff = strfind(data,"^%b<>%s+(%S+)%s*(%S*)")
         if cmd == "!restartscripts" then
            frmHub:UnregBot("-->"..T.."<--")
            StopTimer()
         elseif cmd == "!light" then
            if onoff == "on" then
               T = nil
               StartTimer()
               User:SendData(" started")
               return 1
            elseif onoff == "off" then
               StopTimer()
               frmHub:UnregBot("-->"..T.."<--")
               T = nil
               User:SendData(" stopped")
               return 1
            end
         end
      end
   end
end

plop
Title:
Post by: Ubikk on 21 December, 2004, 18:15:57
My hub is very small.. it usually has 20-30 users :D

How much bandwith does that consume? :)
Title:
Post by: Ubikk on 21 December, 2004, 18:20:40
P.S: Why shouldn't use it.. it looks so darn nice 8)
Title:
Post by: plop on 21 December, 2004, 23:16:56
QuoteOriginally posted by Ubikk
P.S: Why shouldn't use it.. it looks so darn nice 8)
with the default length i set, this script uses 80 bytes per second upload PER user.
in your hub it takes between 1.6 and 2.3 KB/s.

plop