ShoutStats To Lua 5
 

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

ShoutStats To Lua 5

Started by Ferocious Beast, 29 March, 2005, 20:56:47

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ferocious Beast

any 1 can help me plz to convert this script to lua 5?
-- ShoutStats 1.0c
--
-- by Mutor The Ugly
-- Requested By Bastya_Elvtars
--
-- ShoutCAST Status Grabber
-- Grabs the current stream info
-- Return to user or send to all
--
-- Bug fix by Mutor 10/8/04
--	Fixed double url...
--
-- Added Timer function 10/24/04
-- requested vy Psycho_Chihuahua
--User Settings-------------------------------------------------------------------------------------
Bot = "[ShoutCastStats]"		--Name for bot
Command1 = "+sr"			--Get status now
Command2 = "+srall"			--Toggle send to all on/off
Mins = 60				--Zeitabstand zwischen den Meldungen in Minuten
TimerOn = 1				--Timer An - Aus mit 1 oder 0
ghostin = "http://helvetia.ath.cx"	--SHOUTcast D.N.A.S. Status Address
gport = 8000				--Port to connect to
gfile = "/index.html"			--default file for web page
Send2Main = "yes"			--Send results to all users? 'yes/no'
--End User Settings----------------------------------------------------------------------------------
--	
function Main() 
frmHub:RegBot(Bot)
SetTimer(Mins*60000)
Timed = ""
StartTimer()
end

function OnTimer()
	Timed = 1
	GetNews()
	return 1
end
	
function GetNews(user, data)
	ghost = ghostin
	ghost = gsub(ghost, "http://","")
	ghost = gsub(ghost, "HTTP://","")
GETHTML = "GET "..gfile.." HTTP/1.1\r\nHost: "..ghost.."\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n"
local socket, err = connect(ghost, gport)
	if socket == nil then
		local dsp2
		dsp2 = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
		dsp2 = dsp2.."\t >Connect Status:\t  **Failed! - Unable To Connect\r\n"
		dsp2 = dsp2.."\t >Failure Cause:\t Bad Address or Port Number\r\n"
		dsp2 = dsp2.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
		user:SendData(Bot,dsp2)
	return 1
	end
	local code = ""
	if not err then
		socket:timeout(4)
		socket:send(GETHTML..strchar(13,10))
		local line = ""
		while not err do
			line, err = socket:receive("*l")
			code = code..line
			x = gsub(code, "^(.+)%s*Current Stream Information","")
			x = gsub(x, "Average","Avg%.")
			x = gsub(x, "(%s+)Written","")
			x = gsub(x, "Current Song%s.+(<%/td>.+)","")
			x = gsub(x, "
(.+)Written","Written")
			x = gsub(x, "Written%s.+","")
			x = gsub(x, "(aim.+A\">)","")
			x = gsub(x, "(%S+","")
			x = gsub(x, " "," ")
			x = gsub(x, ""","\"")
			x = gsub(x, "»","?")
			x = gsub(x, "&","&")
			x = gsub(x, "<","<")
			x = gsub(x, ">",">")
			x = gsub(x, "%%20"," ")
			x = gsub(x, "%s%s+","")
			x = gsub(x, "™","?")
			x = gsub(x, "©","?")
			x = gsub(x, "®","?")
			x = gsub(x, "•","?")
			x = gsub(x, "°","?")
			x = gsub(x, "·","?")
			x = gsub(x, "","\r\n\t")
			x = gsub(x, "","\t - \t")
			x = gsub(x, "
","\r\n")
			x = gsub(x, "<([^>]-)>","")
		end
		socket:close()
	end
	socket:close()
local dsp
dsp = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=<>=-=\r\n"
dsp = dsp.."\t\tSHOUTcast D.N.A.S. Status For: \t[ "..ghost..":"..gport.." ]\r\n"
dsp = dsp.."\t\t\t**** Current Stream Information ****\r\n"
dsp = dsp.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=<>=-=\r\n"
dsp = dsp..x
	if Timed == 1 then 
		SendToAll(Bot,dsp.."\r\n")
		Timed = 0
		return 1 
	end
	if Send2Main == "yes" then
		SendToAll(Bot,dsp.."\r\n")
	else
		user:SendData(Bot,dsp.."\r\n")
	end
end

function DataArrival(user, data)
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(Bot)) == "$To: "..Bot) then
		data = strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"^%b<>%s+(%S+)")--
			if (cmd == Command1) then
				GetNews(user, data)
				return 1
			elseif (cmd == Command2) then
				if Send2Main == "no" then Send2Main = "yes"
					user:SendData(Bot,"Shoutcast status ' Send To All ' is now [ON]")
				elseif Send2Main == "yes" then Send2Main = "no"
					user:SendData(Bot,"Shoutcast status ' Send To All ' is now [OFF]")
				return 1	
				end
			end
		end
	end

tnkx
My New Hub:
PsyBeast.Kicks-Ass.Org
Trance Hub.

bastya_elvtars

New PtokaX does not include LUASockets, so every second spent on converting this is useless. :(
Everything could have been anything else and it would have just as much meaning.

jiten

I was gonna say that too...  ;)

Ferocious Beast

My New Hub:
PsyBeast.Kicks-Ass.Org
Trance Hub.

Stravides

#4
So am i right in saying that the ShoutCast / Winamp / Ptokax Cannot be used anymore ?? I am wondering as I am not sure how this works...
I cannot get the blooming thing to work and its getting frustrating - code used is

-- Shoutcast interface through PtokaX script 
-- Author:  RabidWombat
-- Modded by: yepyepyep4711, Blackfox & Mutor

-- Sig snipped to fit in this window !!!!!

sBotName = "DJ Gollum";

sCleverDir = ""; 
sHelpOutput = "\r\n\t\t\tSHOUTcast: User Commands\r\n\t\t=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n"; 
sOpHelpOutput = "\r\n\t\t\tSHOUTcast: Op Commands\r\n\t\t=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n"; 
Mins = 4	-- Interval [in minutes] between displaying current tune.
TimerOn = "1"	-- Start script with Now Playing timer on/off "1"=on "0"=off [runs play command too]
ShoutcastAddy = "http://rpgbooks-cymru.no-ip.org:8000" --Include port number here.
SendCmdMenu = "yes"	--Send context menu? (right click menu)
SCMenu= "SHOUTCast"	--Name for context menu
--
--
OpCmds = ""
UserCmds = ""
TrackCmd = ""

function OnTimer()
ShoutCastNpTimer()
end

function Main() 
frmHub:RegBot(sBotName); -- uncomment to see bot in user list and allow bot to pm
SetTimer(Mins*60000)
	if TimerOn == "1" then
		execute(sCleverDir.."clever.exe play");
		play="1" 
		StartTimer()
	end

tCommands = { 
["!SC.next"] = {ShoutCastNext,1,"Play next song in playlist"}, 
["!SC.prev"] = {ShoutCastPrev,1,"Play prev song in playlist"},
["!SC.rew"] = {ShoutCastRew,1,"Play current track over again"},
["!SC.which"] = {ShoutCastGetTrack,1,"Get current song's track number"}, 
["!SC.plist"]= {ShoutCastPlayList,0,"Display song playlist in PM"}, 
["!SC.playn"]= {ShoutCastPlayNumber,2,"Play track number x of the playlist"}, 
["!SC.play"]= {ShoutCastPlay,1,"Play"}, 
["!SC.pause"]= {ShoutCastPause,1,"Pause"}, 
["!SC.stop"]= {ShoutCastStop,1,"Stop"}, 
["!SC.shuff"]= {ShoutCastShuffle,1,"Toggles shuffle. Displays state"},
["!SC.np"]= {ShoutCastNp,0,"Display Now Playing"}, 
["!SC.npoff"]= {ShoutCastKillTimer,1,"Stop Now Playing Timer"},
["!SC.npon"]= {ShoutCastStartTimer,1,"Start Now Playing Timer"},
["!SC.status"]= {ShoutCastStatus,0,"Display status (Play/Stop/Pause)"},
["!SC.sprop"]= {ShoutCastSP,0,"Display song info. (View stream info in player)"}, 
["!SC.help"]= {ShoutCastHelp,0,"Help message"}, 
};
 
	for sCmd, tCmd in tCommands do 
		if(tCmd[2] == 1) then 
			sOpHelpOutput = sOpHelpOutput.."\t\t"..sCmd.."\t-\t"..tCmd[3].."\r\n";
			OpCmds = OpCmds.."$UserCommand 1 1 "..SCMenu.."\\"..sCmd.." $<%[mynick]> "..sCmd.." ||" 
		elseif(tCmd[2] == 2) then
				TrackCmd = TrackCmd.."$UserCommand 1 1 "..SCMenu.."\\"..sCmd.." $<%[mynick]> "..sCmd.." %[line:Track No.]||"
			
		else 
			sHelpOutput = sHelpOutput.."\t\t"..sCmd.."\t-\t"..tCmd[3].."\r\n";
			UserCmds = UserCmds.."$UserCommand 1 1 "..SCMenu.."\\"..sCmd.." $<%[mynick]> "..sCmd.." ||" 
		end 
	end 
end 

function DataArrival(curUser, sData) 
local s, e, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$"); 
	if(cmd == nil) then return 0; end 
		cmd = strlower(cmd); 
	if(tCommands[cmd] and (tCommands[cmd][2] == 0 or curUser.bOperator)) then 
		--curUser:SendData(sData); 
		tCommands[cmd][1](curUser, args); 
		return 1; 
	end 

end 

function NewUserConnected(curUser,data)
if TimerOn ~= 1 then
if play ~= 1 then
execute(sCleverDir.."clever.exe status > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", ""); 
		if line == "Play" then
		curUser:SendData("\r\n\t\tThis hub is also hosting a Winamp SHOUTcast server\r\n\t\tTo add this shoutcast to your bookmarks in winamp,\r\n\t\tpress [CTRL] + L and paste "..ShoutcastAddy.."\r\n")
	end 
	readfrom();
end
end
	end
	if SendCmdMenu == "yes" then
		curUser:SendData(sBotName, SCMenu.." menu enabled, right click hub tab for commands.")
			curUser:SendData (UserCmds)
			if curUser.bOperator then
				curUser:SendData(OpCmds)
				curUser:SendData(TrackCmd)
			end
	end 
end

OpConnected = NewUserConnected

----------------------- [Next command]
function ShoutCastNext(curUser)
execute(sCleverDir.."clever.exe next");
	if play=="0" then
		execute(sCleverDir.."clever.exe play");
	end 
execute(sCleverDir.."clever.exe songtitle > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", ""); 
		SendToAll(sBotName, "Next track ( "..line.." ) selected by "..curUser.sName); 
	end 
	readfrom();
end 
----------------------- [Prev command]
function ShoutCastPrev(curUser) 
	if play=="0" then
		execute(sCleverDir.."clever.exe play");
	end
execute(sCleverDir.."clever.exe prev");
execute(sCleverDir.."clever.exe songtitle > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", ""); 
		SendToAll(sBotName, "Previous track ( "..line.." ) Chosen by: "..curUser.sName); 
	end 
	readfrom(); 
end 
----------------------- [Rewind command]
function ShoutCastRew(curUser) 
execute(sCleverDir.."clever.exe stop");
execute(sCleverDir.."clever.exe play");
execute(sCleverDir.."clever.exe songtitle > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", ""); 
		SendToAll(sBotName, "Rewinding... "..curUser.sName.." wants hear ( "..line.." ) again!"); 
	end 
	readfrom(); 
end
----------------------- [Get Track No. command]
function ShoutCastGetTrack(curUser) 
execute(sCleverDir.."clever.exe getplpos > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", ""); 
		curUser:SendData(sBotName, "Current song's track number is: [ "..line.." ]"); 
	end 
	readfrom();
end 
----------------------- [Playlist command]
function ShoutCastPlayList(curUser) 
execute(sCleverDir.."clever.exe playlist > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", "\r\n"); 
		curUser:SendPM(sBotName, "\r\n"..line); 
	end 
	readfrom();
end 
----------------------- [Play command]
function ShoutCastPlay(curUser) 
execute(sCleverDir.."clever.exe play");
execute(sCleverDir.."clever.exe songtitle > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", " ), "); 
		SendToAll(sBotName, curUser.sName.." has started the ShoutCast Server. Current title: "..line); 
	end 
	readfrom(); 
play="1"
end 
----------------------- [Play Track command]
function ShoutCastPlayNumber(curUser, args) 
	if(args and tonumber(args)) then 
		execute(sCleverDir.."clever.exe play "..tonumber(args)); 
		execute(sCleverDir.."clever.exe songtitle > output.tmp"); 
		readfrom("output.tmp"); 
		local line = read("*a"); 
			if(line) then 
				line = gsub(line, "\n", ""); 
			SendToAll(sBotName, curUser.sName.." has selected track #"..tonumber(args).." ( "..line.." )"); 
			end 
	end
	readfrom(); 
end 
----------------------- [Pause command]
function ShoutCastPause(curUser) 
execute(sCleverDir.."clever.exe pause");
SendToAll(sBotName, curUser.sName.." has paused the ShoutCast Server.");
return 1 
end 
----------------------- [Stop command]
function ShoutCastStop(curUser) 
execute(sCleverDir.."clever.exe stop");
SendToAll(sBotName, curUser.sName.." has stopped the ShoutCast Server.");
StopTimer()
play="0"
end
----------------------- [Shuffle command]
function ShoutCastShuffle(curUser) 
execute(sCleverDir.."clever.exe swshuffle > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", ""); 
		SendToAll(sBotName, "Shuffle is [ "..line.." ]"); 
	end 
	readfrom();
end 
----------------------- [Status command]
function ShoutCastStatus(curUser) 
execute(sCleverDir.."clever.exe status > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", ""); 
		curUser:SendData(sBotName, "Shoutcast mode: [ "..line.." ] on "..ShoutcastAddy); 
	end 
	readfrom();
end 
----------------------- [Song Properties command]
function ShoutCastSP(curUser)
execute(sCleverDir.."clever.exe getinfo > output.tmp"); 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", "\r\n"); 
		curUser:SendData(sBotName, "\r\n Song info  >> "..line.." View stream info in your player"); 
	end 
	readfrom(); 
end 
----------------------- [Now Playing command]
function ShoutCastNp(curUser)
execute(sCleverDir.."clever.exe songtitle > output.tmp");
	if play=="0" then
		curUser:SendData(sBotName, "Start playing a title before using Now Playing commands")
		return 1
	end  
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", "");
		SendToAll(sBotName, "\t Now Playing on "..ShoutcastAddy.." > "..line);
	end 
	readfrom(); 
end  
----------------------- [Now Playing Timer]
function ShoutCastNpTimer(curUser)
execute(sCleverDir.."clever.exe songtitle > output.tmp"); 
		if play=="0" then
			curUser:SendData(sBotName, "Start playing a title before using Now Playing commands")
			return 1
		end 
readfrom("output.tmp"); 
local line = read("*a"); 
	if(line) then 
		line = gsub(line, "\n", "");
		SendToAll(sBotName, "\t Now Playing on "..ShoutcastAddy.." > "..line);
	end 
	readfrom(); 
end  
----------------------- [Stop Now Playing Timer]
function ShoutCastKillTimer(curUser)
	if(curUser.bOperator) then 
		StopTimer()
		curUser:SendData(sBotName,"Now Playing timer stopped.")
	end
end
----------------------- [Start Now Playing Timer]
function ShoutCastStartTimer(curUser)
	if(curUser.bOperator) then
		if play=="0" then
			curUser:SendData(sBotName, "Start playing a title before using Now Playing commands")
			return 1
		end 
		StartTimer()
		curUser:SendData(sBotName,"Now Playing timer started.")
	end
end
----------------------- [Help command]
function ShoutCastHelp(curUser)
curUser:SendData(sBotName, sHelpOutput); 
	if(curUser.bOperator) then 
		curUser:SendData(sBotName, sOpHelpOutput); 
	end
curUser:SendData("\r\n\r\n\t\tTo add this shoutcast to your bookmarks in winamp,\r\n\t\tpress [CTRL] + L and paste "..ShoutcastAddy.."\r\n")
end
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

Dessamator

QuoteOriginally posted by bastya_elvtars
New PtokaX does not include LUASockets, so every second spent on converting this is useless. :(
Ignorance is Bliss.

Dessamator

QuoteOriginally posted by Mutor
to correct the socket compilation problem.

For may reasons I want sockets. NightLitch has socket support in his new hubsoft [Voltron]. He had offered to help do the same for PtokaX. Naturally the source code for PtokaX is required by him for this, and as of yet it will not be shared with even NL. So unless PTA/PPK can sort it out on their own, we are socket-less.

indeed, but ppk mentioned that he didnt know how to do so, unless im wrong, and he suggested that we did it as an external addon
Ignorance is Bliss.

Stravides

Well I suppose that this then would suffice to do the same job - again requires Clever.exe etc...

Just one Tiny Problem....
Cannot locate where to place the return 1 so that it doesnt repeat the command typed to the hub interface :(

Please help....


-- Shoutcast interface through PtokaX script
-- Author: RabidWombat
-- Requirements: the winamp source of the shoutcast server
-- is running on the hub server where this script is AND
-- you have installed Clever (a GREAT utility)
-- This is the version I downloaded for testing purposes
-- [URL]http://www.jukkis.net/clever/clever_2_98.zip[/URL]
-- This is site for all offered versions:
-- [URL]http://www.jukkis.net/[/URL]
--//Modded By Madman
--//Added !sc.song
--//Guide Added
--//More Stuff Added
--//Even More On Ubikk's Request ;p
--//Further modded by Madman Quattro and Pothead
--//Added Myinfostring and some modifications... (thanks to Madman and Pothead)
--//Added A Switch For The Tag
--//Added AllowedProfiles
--//Removed AllowedProfiles
--//Request By Quattro
--//Added RoboCop Profiles Support, The Higer Profile, More Commands
--//Converted to lua 5 by Madman
--//Thanks Typhoon for help with file handling
sCleverDir = "C:\\clever\\"; 
sBotName = "DJ Gollum"
Wver = "5.04" --//What Version Of Winamp You Are Running
SendTag = 0 --//Should The Bot Have A Tag?
if SendTag == 1 then
	BotEmail = "gollum@rpgbooks-cymru.no-ip.org?"
	BotSpeed = "MusicFlys!"
	BotDescr = "WinampScript!"
	BotTag = ""
	BotShare = 0
	MyInfoString = "$MyINFO $ALL "..sBotName.." "..BotDescr.." "..BotTag.."$ $"..BotSpeed..string.char( 1 ).."$"..BotEmail.."$" ..BotShare.."$"
end
low = string.lower;
sHelpOutput 		= "Commands\r\n";
sOpHelpOutput 		= "Op Commands\r\n";
sModHelpOutput 		= "Moderator Commands\r\n";
sMasterHelpOutput 	= "Master Commands\r\n";
sFoundHelpOutput 	= "NetFounder Commands\r\n";
--For ShoutCastSong
Msg = "\r\n***********************************************************************************"..
"\r\nWelcome to RPGBooks Cymru Hub Radio is Up and Running on "..
"\r\nWEBSITE HERE/listen.pls "..
"\r\nYou can PM an Op with a request from the Playlist."..
"\r\n"..
"\r\nWe are currently playing :"
Msg2 = "\r\n***********************************************************************************"
function NewUserConnected(curUser)
	if SendTag == 1 then
		curUser:SendData(MyInfoString)
	elseif SendTag == 0 then
	end
end
OpConnected = NewUserConnected

function Main()
	tCommands = {
	--//Operator = 1
	--//Moderator = 2
	--//Master = 3
	--//NetFounder = 4
	--//All = 0
		--				tCmd[1]				tCmd[2]		tCmd[3]
		[low("!SC.next")] 		= { ShoutCastNext,		1,		"Play next song in playlist" },
		[low("!SC.prev")] 		= { ShoutCastPrev,		1,		"Play prev song in playlist" },
		[low("!SC.playlist")]		= { ShoutCastPlayList,		0,		"Display Playlist" },
		[low("!SC.play")]		= { ShoutCastPlay,		4,		"Play" },
		[low("!SC.pause")]		= { ShoutCastPause,		4,		"Pause" },
		[low("!SC.stop")]		= { ShoutCastStop,		4,		"Stop" },
		[low("!SC.status")]		= { ShoutCastStatus,		0,		"Display Status" },
		[low("!SC.help")]		= { ShoutCastHelp,		0,		"Help Message" },
		[low("!SC.song")]		= { ShoutCastSong,		0,		"SongTitle"},
		[low("!SC.volup")]		= { ShoutCastVolUp,		3,		"Volume Up"},
		[low("!SC.voldn")]		= { ShoutCastVolDn,		3,		"Volume Down"},
		[low("!SC.playnr")]		= { ShoutCastPlayNr,		3,		"Play nr X track"},
		[low("!SC.tracknr")]		= { ShoutCastGetTrack,		2,		"Get current song's track number"}, 
		[low("!SC.vol")]		= { ShoutCastVol,		2,		"Set Volume 0-255"},
		[low("!SC.volhelp")]		= { ShoutCastVolHelp,		2,		"Volume Help"},
		[low("!SC.pretty")]		= { ShoutCastPretty, 		1,		"Display Pretty info"},
--		[low("!SC.test")]		= { ShoutCastTest,		1,		 "Test"},
--		[low("!SC.test2")]		= { ShoutCastTest2,		1,		 "Test With Output.tmp"},
	};

---------------Modded For Quattro
	for sCmd, tCmd in tCommands do
		if (tCmd[2] == 4) then
			sFoundHelpOutput = sFoundHelpOutput..sCmd.."\t-\t"..tCmd[3].."\r\n";
		elseif (tCmd[2] == 3)then
			sMasterHelpOutput = sMasterHelpOutput..sCmd.."\t-\t"..tCmd[3].."\r\n";
		elseif (tCmd[2] == 2) then
			sModHelpOutput = sModHelpOutput..sCmd.."\t-\t"..tCmd[3].."\r\n";
		elseif (tCmd[2] == 1) then
			sOpHelpOutput = sOpHelpOutput..sCmd.."\t-\t"..tCmd[3].."\r\n";
		elseif (tCmd[2] == 0) then
			sHelpOutput = sHelpOutput..sCmd.."\t-\t"..tCmd[3].."\r\n";
		end
	end
---------------Modded For Quattro

	frmHub:RegBot(sBotName);
	if SendTag == 1 then
		SendToAll(MyInfoString)
	end
end

function ChatArrival(curUser, sData)
	local s, e, cmd, args = string.find(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");
	if(cmd == nil) then 
		return 1
	end
	cmd = string.lower(cmd);
	if(tCommands[cmd] and (tCommands[cmd][2] == 0 or curUser.bOperator )) then
		curUser:SendData(sData)
		tCommands[cmd][1](curUser, args)
		return 1
	end
end

function ShoutCastPretty(curUser)
	os.execute(sCleverDir.."clever.exe prettyinfo > output.tmp"); --//Shows Pretty Info About The Song
	local file = io.input("output.tmp");
	local line = io.read("*a");
	if(line) then
		line = string.gsub(line, "\n", "\r\n");
		SendToAll(sBotName, "\r\n"..line);
	end
	file:read()
end

function ShoutCastVolUp(curUser)
	os.execute(sCleverDir.."clever.exe volup"); --//Increase The Volume
	curUser:SendData(sBotName, "Volume Increased")
end

function ShoutCastVol(curUser, args)
	if(args and tonumber(args)) then 
		os.execute(sCleverDir.."clever.exe volume "..tonumber(args));
		curUser:SendData(sBotName, "Volume Set To " ..args)
	end
end

function ShoutCastVolDn(curUser)
	os.execute(sCleverDir.."clever.exe voldn"); --//Decrease The Volume
	curUser:SendData(sBotName, "Volume Decreased")
end

function ShoutCastVolHelp(curUser) --//Volume Help
	if curUser.bOperator then
		curUser:SendPM(sBotName,"\r\nVolume Help\r\n"..
		"Write !sc.vol X\tX = Some Nr\n"..
		"The Text Bellow Show What A Nr Is In Volume %\r\n"..
		"10 = 3 %\r\n"..
		"20 = 7 %\r\n"..
		"30 = 11 %\r\n"..
		"40 = 15 %\r\n"..
		"50 = 19 %\r\n"..
		"60 = 23 %\r\n"..
		"70 = 27 %\r\n"..
		"80 = 31 %\r\n"..
		"90 = 35 %\r\n"..
		"100 = 39 %\r\n"..
		"110 = 43 %\r\n"..
		"120 = 47 %\r\n"..
		"130 = 50 %\r\n"..
		"140 = 54 %\r\n"..
		"150 = 58 %\r\n"..
		"160 = 62 %\r\n"..
		"170 = 66 %\r\n"..
		"180 = 70 %\r\n"..
		"190 = 74 %\r\n"..
		"200 = 78 %\r\n"..
		"210 = 82 %\r\n"..
		"220 = 86 %\r\n"..
		"230 = 90 %\r\n"..
		"240 = 94 %\r\n"..
		"250 = 98 %\r\n"..
		"255 = 100 %\r\n");
	end
end

function ShoutCastTest(curUser, args) --//For Testing
	if(args and tonumber(args)) then 
		os.execute(sCleverDir.."clever.exe play "..tonumber(args)); 
	end
end

function ShoutCastTest2(curUser) --//For Testing
	os.execute(sCleverDir.."clever.exe -h > output.tmp");
	local file = io.input("output.tmp");
	local line = io.read("*a");
	if(line) then
		line = string.gsub(line, "\n", "\r\n");
		curUser:SendData(sBotName, "\r\n"..line);
	end
	file:read()
end

function ShoutCastNext(curUser) --//Play Next Song
	os.execute(sCleverDir.."clever.exe next");
end

function ShoutCastPrev()
	os.execute(sCleverDir.."clever.exe prev"); --//Play Prev Song
end

function ShoutCastPlayNr(curUser, args)
	if(args and tonumber(args)) then 
		os.execute(sCleverDir.."clever.exe play")
		os.execute(sCleverDir.."clever.exe play "..tonumber(args)); 
		os.execute(sCleverDir.."clever.exe songtitle > output.tmp"); 
		local file = io.input("output.tmp"); 
		local line = io.read("*a"); 
			if(line) then 
				line = string.gsub(line, "\n", ""); 
				SendToOps(sBotName, curUser.sName.." has selected track "..tonumber(args).." [ "..line.." ]"); 
			end
		file:read()
	end
end

function ShoutCastPlayList(curUser) --//Show Playlist
	os.execute(sCleverDir.."clever.exe playlist > output.tmp");
	local file = io.input("output.tmp");
	local line = io.read("*a");
	if(line) then
		line = string.gsub(line, "\n", "\r\n");
		curUser:SendPM(sBotName, "\r\n"..line);
	end
	file:read()
end


function ShoutCastGetTrack(curUser) --//Get Track nr
	os.execute(sCleverDir.."clever.exe getplpos > output.tmp"); 
	local file = io.input("output.tmp"); 
	local line = io.read("*a"); 
	if(line) then 
		line = string.gsub(line, "\n", ""); 
		curUser:SendData(sBotName, "Current song's track number is: [ "..line.." ]"); 
	end 
	file:read()
end 

function ShoutCastPlay()
	os.execute(sCleverDir.."clever.exe play"); --//Play
end

function ShoutCastPause()
	os.execute(sCleverDir.."clever.exe pause"); --//Pause
end

function ShoutCastStop()
	os.execute(sCleverDir.."clever.exe stop"); --//Stop
end

function ShoutCastStatus(curUser)
	os.execute(sCleverDir.."clever.exe status > output.tmp");
	local file = io.input("output.tmp");
	local line = io.read("*a");
	if(line) then
		line = string.gsub(line, "\n", "\r\n");
		curUser:SendData(sBotName, "The status is: "..line);
	end
	file:read()
end

function ShoutCastSong(curUser) --//Playing Song
	os.execute(sCleverDir.."clever.exe songtitle > output.tmp")
	local file = io.input("output.tmp");
	local line = io.read("*a");
	if(line) then
		SendToAll(sBotName, Msg.." "..line..Msg2);
	end
	file:read()
end

function ShoutCastSongLength(curUser)
	os.execute(sCleverDir.."clever.exe songlength > output.tmp"); --//Total Length Of Song
	local file = io.input("output.tmp");
	local line = io.read("*a");
	if(line) then
		line = string.gsub(line, "\n", "\r\n");
		curUser:SendData(sBotName, "\r\n"..line);
	end
	file:read()
end

function ShoutCastTimeLeft(curUser)
	os.execute(sCleverDir.."clever.exe timeleft > output.tmp"); --//Shows Timeleft
	local file = io.input("output.tmp");
	local line = io.read("*a");
	if(line) then
		line = string.gsub(line, "\n", "\r\n");
		curUser:SendData(sBotName, "\r\n"..line);
	end
	file:read()
end

---------------Modded For Quattro
function ShoutCastHelp(curUser) --//Help
	curUser:SendData(sBotName,
	"\r\n"..sHelpOutput);
	if curUser.iProfile == 5 then
		curUser:SendData(sBotName,
		"\r\n"..sFoundHelpOutput.."\r\n"..
		"\r\n"..sMasterHelpOutput.."\r\n"..
		"\r\n"..sModHelpOutput.."\r\n"..
		"\r\n"..sOpHelpOutput);
	elseif curUser.iProfile == 0 then
		curUser:SendData(sBotName,
		"\r\n"..sMasterHelpOutput.."\r\n"..
		"\r\n"..sModHelpOutput.."\r\n"..
		"\r\n"..sOpHelpOutput);
	elseif curUser.iProfile == 4 then
		curUser:SendData(sBotName,
		"\r\n"..sModHelpOutput.."\r\n"..
		"\r\n"..sOpHelpOutput);
	elseif curUser.bOperator then
		curUser:SendData(sBotName,
		"\r\n"..sOpHelpOutput);

	end
end
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

Madman

QuoteOriginally posted by Stravides
Just one Tiny Problem....
Cannot locate where to place the return 1 so that it doesnt repeat the command typed to the hub interface :(
Dont get it... :/ what u mean with hub interface? all commands should be written in dc....
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Stravides

#9
[20:14:10] !SC.song
[20:14:10]
***********************************************************************************
Welcome to RPGBooks Cymru Hub Radio is Up and Running on
//webaddress:8000/listen.pls
You can PM an Op with a request from the Playlist.

We are currently playing : Bic Runga - Sway

***********************************************************************************


I do not want the [20:14:10] !SC.song  to appear - Tried placing return 1; and return 1 in numerous places

Sorry if was unclear
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

Madman

oh okey... neither do i... but you are the only one who sees the command...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Stravides

errrr thanks ..... :(
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

SMF spam blocked by CleanTalk