PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Exile on 08 February, 2005, 22:44:07

Title: write to a file on another server
Post by: Exile on 08 February, 2005, 22:44:07
i have written a script that displays information about my hub radio stream ona timer...I wanted to be able to write to the configuration file on the server, from the gui that I have programmed to write to the file, I can write to the file locally, but I don't know how to write to a file over the internet... is this possible

-- Hub Radio Advert Script by Exile
-- Sends a PM to users to display the hub radio link...

assert(dofile("Nu-Grime Settings.ini"),"Nu-GrimeSettings.ini not found, check your ptokax path")

function Main()
frmHub:RegBot(bot)
SetTimer(Mins*60000)
end

function DataArrival(user, data)
s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
if (cmd==Prefix..Start) and user.bOperator then
StartTimer()
OnTimer()
return 1
elseif (cmd==Prefix..Stop) and user.bOperator then
StopTimer()
Stopped()
return 1
end
end
function OnTimer()
SendToAll(BotName,"\r\n\r\n*** "..DjName.." is now Streaming Live Radio on "..StationName.." ***\r\n*** "..RadioStream.." ***\r\n*** "..RadioStream.." ***\r\n*** "..RadioStream.." ***\r\n*** "..DjName.." is now Streaming Live Radio on "..StationName.." ***\r\n")
end
function Stopped()
SendToAll(BotName,"\r\n\r\n*** Hub Radio has now Stopped Streaming, Thankyou for listening :D ***\r\n")
end

Truly Exile,
Title:
Post by: Tw?sT?d-d?v on 08 February, 2005, 23:41:14
Hi ,  

Let me get this right,you wanna send your hub stats over the internet.....I ask why??


isnt it just the same as sending it out in pm ....as users will not still see it over the internet ,unless they are browsing that web page ......    

Or am i getting the wrong idea here....
Title: u got the wrong idea...
Post by: Exile on 09 February, 2005, 00:06:06
I have a GUI and a script, which together display a message about the hub radio...in the hub

i need to be able to change variables which are saved in a config file on the hub server...and I dont know how
Title:
Post by: plop on 09 February, 2005, 01:58:55
upload the changed config by ftp 2 the remote server.

plop
Title: a bit too hard...
Post by: Exile on 09 February, 2005, 04:09:01
this seems a bit long to do, is it not possible to just write to the file through the hub
like the way we add things to a release bot?
Title:
Post by: plop on 09 February, 2005, 12:19:48
QuoteOriginally posted by Exile
this seems a bit long to do, is it not possible to just write to the file through the hub
like the way we add things to a release bot?
how would the gui do this?
it would only be possible if the gui connects 2 the hub.
if not, using ftp is much easier 2 implement then making it connect 2 the hub.
or you would have 2 send the config 2 the hub yourself, so in my eyes using ftp is much nicer.

plop
Title: rite plop, could you give me a hand then...
Post by: Exile on 09 February, 2005, 12:26:49
I will need to know how to make the LUA script read from a FTP site then, right? I can program the GUI easily...that's not a problem, It's just the LUa side that I'm going to struggle with. I've never connected to FTP through LUA before, any help?
Title:
Post by: bastya_elvtars on 09 February, 2005, 13:05:09
http://www.plop.nl/ptokaxbots/Mutor/DCFTP_1.0.lua
Title:
Post by: plop on 09 February, 2005, 15:17:16
QuoteOriginally posted by Exile
I will need to know how to make the LUA script read from a FTP site then, right? I can program the GUI easily...that's not a problem, It's just the LUa side that I'm going to struggle with. I've never connected to FTP through LUA before, any help?
make the gui upload it, the hub freezes during the transfer if you have a lua script doing it.

plop
Title: A sneak preview...
Post by: Exile on 10 February, 2005, 13:20:24
Ive managed to program my own GUI for the script I mentioned. It works fine, I'll post a few pictures later, lookssweet :D