Author Topic: help with non ptokax script plz ??  (Read 1849 times)

0 Members and 1 Guest are viewing this topic.

Offline lysergicacid

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
help with non ptokax script plz ??
« on: 11 January, 2005, 01:14:06 »
ok this is what ive got  -->>

Crontab -->>
Code: [Select]
*/1 * * * * /usr/local/bin/hubfortune

pathetic but functional bash script -->>

Code: [Select]
#!/bin/bash
/usr/bin/fortune > /etc/verlihub/scripts/fortune.txt


Code: [Select]
-- Fortune

botname = "Fortune"
filename = "/etc/verlihub/scripts/fortune.txt"
fortunes = {}
-- 30 min = 60 sec * 30
maxTicks = 1800
-- switch between 1 and nil
enabledTimer = 1

Func = {}

Func.LoadStrings = function()
i = 0
for line in io.lines(filename) do
 if line ~= nil then
  fortunes[i] = line
  i = i+1
 end
end
end

function Main()
VH:AddRobot(botname, 10, "Spam Bot", "Bot/Hub", "bot@hub.com", "1$
Func.LoadStrings()
end

return 1
end

-- Timer
TimerTicks = 0

function VH_OnTimer()
if (enabledTimer) then
 TimerTicks = TimerTicks + 1
 if TimerTicks == maxTicks then
  VH:SendDataToAll("<"..botname.."> "..fortunes[math.random(0, table.getn(fortu$
  TimerTicks = 0
 end
end
end


now its not right all i want to do is get the script to access a txt file i have setup and spam txt outa that every 30 mins into my hub chat anyone know how id accomplish this plz plz plz ???
« Last Edit: 11 January, 2005, 02:21:58 by lysergicacid »

PtokaX forum

help with non ptokax script plz ??
« on: 11 January, 2005, 01:14:06 »

Offline plop

  • Forum God
  • ****
  • Posts: 2 464
  • Karma: +37/-0
(No subject)
« Reply #1 on: 11 January, 2005, 17:26:20 »
give this a try.
Code: [Select]
-- Fortune

botname = "Fortune"
filename = "/etc/verlihub/scripts/fortune.txt"
fortunes = {}
-- 30 min = 60 sec * 30
maxTicks = 1800
-- switch between 1 and nil
enabledTimer = 1

Func = {}

Func.LoadStrings = function()
   i = 0
   for line in io.lines(filename) do
if line ~= nil then
  fortunes[i] = line
  i = i+1
end
   end
end

function Main()
   VH:AddRobot(botname, 10, "Spam Bot", "Bot/Hub", "bot@hub.com", "1$")
   Func.LoadStrings()
end

-- Timer
TimerTicks = 0

function VH_OnTimer()
   if (enabledTimer) then
TimerTicks = TimerTicks + 1
if TimerTicks == maxTicks then
  VH:SendDataToAll("<"..botname.."> "..fortunes[math.random(0, table.getn(fortune))].."1$")
  TimerTicks = 0
end
   end
end

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 <----<<

Offline lysergicacid

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
(No subject)
« Reply #2 on: 16 January, 2005, 05:03:15 »
hmm nope doesnt say anything at all now, ima try get back in nilles hub so i can explain better, ty man

Aka - ?????rg?
« Last Edit: 16 January, 2005, 06:02:34 by lysergicacid »

PtokaX forum

(No subject)
« Reply #2 on: 16 January, 2005, 05:03:15 »