PtokaX forum

Archive => Archived 5.0 boards => Help with scripts => Topic started by: antobach on 24 June, 2006, 10:57:24

Title: mass message
Post by: antobach on 24 June, 2006, 10:57:24
esiste uno script che invia un determinato file txt a tempo..?????? e uno script che ricerca tutti i film musica ecc ecc nel propio hub? grazie a tutti.
Title: Re: mass message
Post by: 6Marilyn6Manson6 on 24 June, 2006, 11:04:38
Quote from: antobach on 24 June, 2006, 10:57:24
esiste uno script che invia un determinato file txt a tempo..?????? e uno script che ricerca tutti i film musica ecc ecc nel propio hub? grazie a tutti.

Anto qui richiedi gli script in inglese perk? ( penso ) sono l'unico italiano qui :)
Anto request your script in english please because ( I think ) I'm only italian here :)
Title: Re: mass message
Post by: 6Marilyn6Manson6 on 24 June, 2006, 11:07:49
--- File in PM by 6Marilyn6Manson6 23/10/2005

botsName = "TXTFile"    --- Change this to whatever u want
TxtFile = "File.txt"   --- be sure to have a file corresponding to this one in the 'scripts'
thecmd = "!loadFile"    --- change this to whatever u want ...

secs = 1000
mins = 60*secs

function Main()
frmHub:RegBot(botsName)--- and Register it again ... ( using the string defined by the ' botsName ' value, again )
end

function ChatArrival( user, data)
if user.bOperator then
data = string.sub(data,1,-2)
local s,e,cmd = string.find( data, "%b<>%s+(%S+)" )
if (cmd == thecmd) then
SendEm()
end
end
end

function SendEm()
local sText = ReadTextFile(TxtFile)
for i, user in frmHub:GetOnlineUsers() do
if user.iProfile == -1 then
user:SendPM(botsName, sText)
end
end
end

function ReadTextFile(file)
local f=io.open(file, "r");
if f then local m=f:read("*all");f:close;return m;end;
return "file isn't there";
end
--// 6Marilyn6Manson6
Title: Re: mass message
Post by: antobach on 24 June, 2006, 11:57:07
Lo so 6Marilyn6Manson6 ma non saprei dove altro cercare..... cmq sei gentilissimo grazie.
Title: Re: mass message
Post by: antobach on 24 June, 2006, 11:58:53
[12:54] Syntax C:\Documents and Settings\user\Desktop\ptokax\scripts\invia file.lua:35: function arguments expected near `;'
Quote



mi da questo errore cosa vuol dire?
Title: Re: mass message
Post by: CrazyGuy on 24 June, 2006, 12:36:14
try replacing


function SendEm()
local sText = ReadTextFile(TxtFile)
for i, user in frmHub:GetOnlineUsers() do
if user.iProfile == -1 then
user:SendPM(botsName, sText)
end
end
end

function ReadTextFile(file)
local f=io.open(file, "r");
if f then local m=f:read("*all");f:close;return m;end;
return "file isn't there";
end


with


function SendEm()
local sText = ReadTextFile(TxtFile)
if sText ~= nil then
for i, user in frmHub:GetOnlineUsers() do
if user.iProfile == -1 then
user:SendPM(botsName, sText)
end
end
end
end

function ReadTextFile(file)
local f=io.open(file, "r")
if f ~= nil then
local m=f:read("*all")
f:close()
return m
else
return nil
end
end

Title: Re: mass message
Post by: antobach on 24 June, 2006, 15:50:56
nada nn funge. >:(
Title: Re: mass message
Post by: 6Marilyn6Manson6 on 24 June, 2006, 16:03:47
Quote from: antobach on 24 June, 2006, 15:50:56
nada nn funge. >:(

Che versione del PtokaX usi?
What's PtokaX version you use?
Title: Re: mass message
Post by: antobach on 24 June, 2006, 16:42:32
l'ultima 0.3.5.0.lua5.0.2.dbg.
Title: Re: mass message
Post by: Thor on 24 June, 2006, 17:34:41
Here is an another version: rewritten txt_show by bastya elvtars. I don't really know, what antobach request.... Maybe this:

folder = frmHub:GetPtokaXLocation().."scripts/massmessages/"

function ChatArrival(curUser,data)
data = string.sub(data,1,-2)
local _,_,cmd,file = string.find(data,"%b<>%s+(%S+)%s*(%S*)")
if cmd == "!loadfile" and curUser.bOperator then
local f=io.open(folder..file..".txt","r")
local Botname = frmHub:GetHubBotName()
if f then
local contents = string.gsub(f:read("*a"),string.char(10), "\r\n")
for i,v in frmHub:GetOnlineUsers(-1) do
v:SendPM(Botname,"\r\n"..contents.."\r\n")
end
f:close()
else
curUser:SendData(Botname,"There is no file "..file.." on the "..folder.." folder!")
end
return 1
end
end
Title: Re: mass message
Post by: antobach on 24 June, 2006, 18:16:51
So che non mi capite ma vi ringrazio lo stesso... rimane il fatto che a tutto questo non ho capito un tubo.... :'(
Dove devo inserirre tutti sti script....
Title: Re: mass message
Post by: antobach on 24 June, 2006, 18:23:15
6Marilyn6Manson6 tu che mi capisci riesci a mettermi insieme tutto questo io in realt? non ho capito un tubo di niente... grazie....
Title: Re: mass message
Post by: 6Marilyn6Manson6 on 24 June, 2006, 18:26:28
Quote from: antobach on 24 June, 2006, 18:23:15
6Marilyn6Manson6 tu che mi capisci riesci a mettermi insieme tutto questo io in realt? non ho capito un tubo di niente... grazie....

Dentro la cartella scripts del PtokaX ci metti questo script creato da Hungarista. Dopodich? sempre dentro la cartella scripts crei una cartella di nome   massmessages   e ci metti dentro il tuo file TXT che intendi caricare... fallo a hub chiuso, e con il comando   !loadfile   puoi vedere il file TXT... Scusa se oggi son scappato ma era successa una piccola urgenza ^^
Title: Re: mass message
Post by: antobach on 24 June, 2006, 18:29:55
grazie gentilissimo come sempre... adesso provo... .. ehehehe ti far? sapere.
Title: Re: mass message
Post by: antobach on 24 June, 2006, 18:53:15
bho sar? stupido io non saprei ma non fa nulla e al comando !loadfile mi dice "There is no file  on the C:/Documents and Settings/user/Desktop/ptokax/scripts/massmessages/ folder!" Ma e impossibile perch? dentro la cartella massmessages ho messo un file txt di tutti i film ma lui non la trova... vacci a capire...
Title: Re: mass message
Post by: antobach on 25 June, 2006, 06:23:58
C iao 6Marilyn6Manson6 volevo dirti che il bot di Hungarista NON FUNZIONA e poi ho notato che non ? un bot a tempo ma a comando, L'ho provato anche sulla versione del ptokax 0.3.4.0 e non funge lo stesso...
non esiste altri script in merito? grazie.
Title: Re: mass message
Post by: antobach on 25 June, 2006, 06:27:51
Hello 6Marilyn6Manson6 I wanted dirti that the bot of Hungarista IT DOES NOT WORK and then I have noticed that is not a bot to time but to commando, I have tried It also on the version of ptokax the 0.3.4.0 and does not act as the same one... does not exist other scripts in merit? thanks


PS:excused to painful English and but use a translator... ehehehe
Title: Re: mass message
Post by: 6Marilyn6Manson6 on 25 June, 2006, 07:31:49
Prova questo:

-- txtlist.lua
--
--  script to (auto)update inbuild txtfiles commands
--  and show the list of commands to users
--  ( shows files only if you have txtxfiles enabled in PtokaX gui )
-- UwV

bot = frmHub:GetHubBotName()
prefix = "!"    --set the prefix for your hub here
command = "!txtlist"   -- command icluding prefix
autoupdate = "yes" -- enable auto updating  "yes" = yes anything else is no
timerinterval  = 60   -- update dirlist.txt  every in minutes

function ChatArrival(user, data)
local s,e,cmd = string.find(data, "^%b<>%s+(%S+)|")
if cmd == command then
user = user.sName
ShowList(user)
return 1
end
end

dir = frmHub:GetPtokaXLocation().."texts/"
file = "txtfiles.dsn"

function ShowList(user)
local handle = io.open( file, "r" )
local t = {}
local tosend = "Well "..user.." here you go then,..\r\n\r\n           ---------- Your Available .txt Commands ---------\r\n"
for line in handle:lines() do
if string.find ( line,"^(%S+)%.txt$" ) then
local _,_,filename = string.find( line,"^([^%.]+)" )
t[filename] = line
tosend = tosend.."            "..prefix..""..filename.."\t\t ( "..line.." )\r\n"
end
end
handle:close()
tosend = tosend.."\r\n           ----------  Please Use them "..user.."   ---------\r\n"
SendPmToNick(user, bot, tosend  )
end

function OnTimer()
os.execute("dir \""..dir.."\" /A-D-S-H /B /O:N > "..file.."") -- show no Dir's,  no System and no Hidden files in Bare format Ordered by Name
end

function Main()
if autoupdate  == "yes" then
SetTimer(60000 * timerinterval)
StartTimer()
end
OnTimer()  -- do timer function once anyway to make our file
end


Metti il tuo file TXT dentro la cartella texts del PtokaX e prova se funziona
Title: Re: mass message
Post by: 6Marilyn6Manson6 on 25 June, 2006, 07:33:01
Oppure provi questo:

-- Txtshow by bastya_elvtars
-- At preconfigured times it shows a text file.

Botname="Texter"

HubAD=
{
   ["18:00"]="blabla.txt",
   ["22:33"]="thx.txt",
   ["01:21"]="ReadMe.txt",
}
--[[["HH:MM"]="filename.txt",

Can even be 18:33 if this is your perversion :)
Does not have to be a textfile reachable by command as well. :)
A textfile can be bound to any number of timestamps.
Just comment a line if you do not need it any longer, or rename the file to a non-existant.
Or, delete the file (if a file does not exist, there are gonna be no errors).
]] 

-- The folder where your text files reside
-- Warning: NOT \ but /
folder="I:/!!!px2!!!"

-- // Don't edit below.

Timer=0

function OnTimer()
local now=os.date("%H:%M")
if Timer~=60 then
   Timer=Timer+1
else
   if HubAD[now] then
local f=io.open(folder.."/"..HubAD[now],"r")
if f then
local contents = string.gsub(f:read("*a"),string.char(10), "\r\n")
SendToAll(Botname,"\r\n"..contents.."\r\n")
f:close()
end
   end
   Timer=0
end
end

function Main()
SetTimer(1000)
StartTimer()
end
Title: Re: mass message
Post by: antobach on 25 June, 2006, 20:00:02
Boys of Nothing not anybody of it goes of of it... not the I succeed a to send not txt of file in not time of determined, thanks for the devoted time I hope me that you will resolve... also of you excuse for the bad English but I use not the translator.
Grazie 6Marilyn6Manson6 ma vedi se ne trovi uno che funge....  :'(