This was requested by Nemezis.
-- HeaderScroller 0.1 by bastya_elvtars
-- for PtokaX 16.xx
-- 2 methods of scrolling!
-- will add command for on/off/scrolling method
-- uses a lot of b/w, use with caution, and don't blame me on crashing your netcard! :P
-- 0.11: fixed the nil topic error. THX Nemezis
-- set the refresh frequency. the bigger it is, the faster text moves, and the faster it moves, the more bandwidth is used. :)
secs=0.3
method=2 -- 1 is left-to-right, 2 is right-to-left
function Main()
SetTimer(secs*1000)
StartTimer()
char=0
end
function GetBanner()
hubname=frmHub:GetHubName()
topic=frmHub:GetHubTopic()
chartab={}
if topic then
banner=hubname.." - "..topic
else
banner=hubname
end
-- leng=string.len(banner)
end
function OnTimer()
GetBanner()
char=char+1
if char < string.len(banner) then
SendToAll("$HubName "..MethodChoice()) -- banner,char,string.len(banner)
elseif char > string.len(banner) and char < string.len(banner)*2 then
SendToAll("$HubName "..string.sub(banner,-(string.len(banner)-char)))
else
char=0
end
end
function MethodChoice()
if method==2 then return string.sub(banner,1,char)
else return string.sub(banner,char,string.len(banner))
end
end
This is v0.2. :) Enjoy!
-- HeaderScroller 0.2 by bastya_elvtars
-- for PtokaX 16.xx
-- 2 methods of scrolling!
-- will add command for on/off/scrolling method
-- uses a lot of b/w, use with caution, and don't blame me on crashing your netcard! :P
-- 0.11: fixed the nil topic error. thx Nemezis
-- 0.2: added full command control from client
-- set the refresh frequency. the bigger it is, the faster text moves, and the faster it moves, the more bandwidth is used. :)
---------------------------------------
-- setttings ---------------------
---------------------------------------
userlevels={ -- if you use default profiles, leave this intact, if not, edit
-- [profile_index]=levelindex,
-- higher levelindex means higher rights
[-1]=1, -- Guest
[0]=5, -- SU
[1]=4, -- OP
[2]=3, -- VIP
[3]=2 -- Reguser
}
allowed=4
secs=0.3
method=2 -- 1 is left-to-right, 2 is right-to-left
defaultstate="on" --"on or "off"
bot="Header-Bot"
-- only change help if you know what u r doing
help_text="\r\n\t\t\tUsage: !header \r\n"..
"\t\t\t----------------------------------------------------------\r\n"..
"\t\t\t!header speed \t\tsets the refresh rate\r\n"..
"\t\t\t!header scroll \t\t\tenables/disables scrolling\r\n"..
"\t\t\t!header method <1/2>\t\t\tsets method, 1 for srolling from left to right, 2 for scrolling from right to left\r\n"..
"\t\t\t!header help\t\t\t\twhat you are staring at. :P\r\n"
---------------------------------------
-- end of settings ------------
---------------------------------------
function Main()
frmHub:RegBot(bot)
state=defaultstate
SetTimer(secs*1000)
StartTimer()
char=0
end
function GetBanner()
hubname=frmHub:GetHubName()
topic=frmHub:GetHubTopic()
chartab={}
if topic then
banner=hubname.." - "..topic
else
banner=hubname
end
-- leng=string.len(banner)
end
function OnTimer()
GetBanner()
char=char+1
if char < string.len(banner) then
SendToAll("$HubName "..MethodChoice()) -- banner,char,string.len(banner)
elseif char > string.len(banner) and char < string.len(banner)*2 then
SendToAll("$HubName "..string.sub(banner,-(string.len(banner)-char)))
else
char=0
end
end
function MethodChoice()
if method==2 then return string.sub(banner,1,char)
else return string.sub(banner,char,string.len(banner))
end
end
function ChatArrival (user,data)
data=string.sub(data,1,string.len(data)-1)
local _,_,cmd,parm1,parm2=string.find(data,"%b<>%s+[%!%+%-%?%#](%S+)%s+(%S+)%s*(%S*)")
if cmd=="header" then
if userlevels[user.iProfile] and userlevels[user.iProfile] >= allowed then
if parm1=="speed" then
if tonumber(parm2) then
StopTimer()
secs=tonumber(parm2)
SetTimer(tonumber(parm2)*1000)
StartTimer()
else
user:SendData(bot,"Incorrect usage, see +header help")
end
elseif parm1=="scroll" then
if parm2=="on" then
if state=="on" then
user:SendData(bot,"I am already working.")
else
SetTimer(secs*1000)
StartTimer()
end
elseif parm2=="off" then
if state=="off" then
user:SendData(bot,"I am already sleeping.")
else
StopTimer()
SetTimer(secs*1000)
SendToAll("$HubName "..banner)
state="off"
end
else
user:SendData(bot,"Incorrect usage, see +header help")
end
elseif parm1=="method" then
if parm2=="1" then
if method==1 then
user:SendData(bot,"Already using this.")
else
method=1
StopTimer()
SetTimer(secs*1000)
StartTimer()
end
elseif parm2=="2" then
if method==2 then
user:SendData(bot,"Already using this.")
else
method=2
StopTimer()
SetTimer(secs*1000)
StartTimer()
end
end
elseif parm1=="help" and parm2=="" then
frmHub:RegBot(bot)
user:SendPM(bot,help_text)
frmHub:UnregBot(bot)
else
user:SendData(bot,"Incorrect usage, see +header help")
end
else
user:SendData(bot,"You aren't allowed to use this command.")
end
return 1
end
end
bastya_elvtars looks great and works ok
dont think this can be done tho is there any way of stopping the tab from scrolling just leaving the main header scrolling
QuoteOriginally posted by Skynet
bastya_elvtars looks great and works ok
dont think this can be done tho is there any way of stopping the tab from scrolling just leaving the main header scrolling
No, that is clientside. As it refreshes hubname, it cannot be switched off.
-- HeaderScroller 0.1 by bastya_elvtars
-- for PtokaX 16.xx
-- 2 methods of scrolling!
-- will add command for on/off/scrolling method
-- uses a lot of b/w, use with caution, and don't blame me on crashing your netcard! :P
-- 0.11: fixed the nil topic error. THX Nemezis
-- setze die geschwindigkeit je h?her die zahl desto fl?ssiger l?uft die schrift
-- desto mehr bandbreite wird aber auch ben?tigt
-- 0.19: make the commands for on/off/scrolling method by Skippy
secs=0.7
method=1 -- 1 ist von links nach rechts, 2 ist von rechts nach links
function Main()
char=0
end
function ChatArrival(curUser, message)
s,e,cmd= string.find(message,"%b<>%s+(%S+)")
if curUser.bOperator ~= nil then
s,e,cmd,status= string.find(message,"%b<>%s(.+)%s(.+)")
if (cmd == "!topic") then
if string.find(status, "on") then
SendToAll(" Topic Scrolling on.")
SetTimer(secs*1000)
StartTimer()
char=0
elseif string.find(status, "change") then
SendToAll(" Topic Scrolling direction change!")
if (method == 2) then
SendToAll(" Topic Scrolling links!")
method=1
elseif (method == 1) then
method=2
SendToAll(" Topic Scrolling rechts!")
end
elseif string.find(status, "off") then
SendToAll(" Topic Scrolling off!")
StopTimer()
if topic then
SendToAll("$HubName "..hubname.." - "..topic)
else
SendToAll("$HubName "..hubname)
end
end
return 1
end
end
end
function GetBanner()
hubname=frmHub:GetHubName()
topic=frmHub:GetHubTopic()
chartab={}
if topic then
banner=hubname.." - "..topic
else
banner=hubname
end
-- leng=string.len(banner)
end
function OnTimer()
GetBanner()
char=char+1
if char < string.len(banner) then
SendToAll("$HubName "..MethodChoice()) -- banner,char,string.len(banner)
elseif char > string.len(banner) and char < string.len(banner)*2 then
SendToAll("$HubName "..banner)
else
char=0
end
end
function MethodChoice()
if method==2 then return string.sub(banner,1,char)
else return string.sub(banner,char,string.len(banner))
end
end
I thought I added that option before... but who knows? :P
i think my script is easier, smaller and i have a better way to change direktion only one command thats yours have 2 commands for that
Nothing...;-)
QuoteOriginally posted by Skippy84
i think my script is easier, smaller and i have a better way to change direktion only one command thats yours have 2 commands for that
OK, feel free, just please upload to script database (preferably in english :P).
QuoteOriginally posted by bastya_elvtars
OK, feel free, just please upload to script database (preferably in english :P).
1) What database? I hear the first time about it. If you spoke about http://ptokaxscripts.sytes.net/ (http://ptokaxscripts.sytes.net/) then this page is not loaded for me :(
2) It seems to me that I've found a
bug. If someone uses
xdc or
DCGUI or
valknut or
javadc then our scrolling topic displays to him like unlimited amount of flooding strings in Main.
One of Linux users told me about it. :(
Can it be fixed somehow? Or I just have to make a "not scrolling" rule for this clients?
Thanx a lot.
NemeziS
it seems to be a unix problem
i have a question shows it the text that displayed normaly in
the topic? or is a other text displayed
It displays a text that was in hub topic. It displays like unlimited amount of flooding strings in Main.
There are some coding problems. Especially if the topic text is typed in russian language. English text displays perfectly, but it looks like unlimited amount of flooding strings in Main, too. :(
And another problem with this DC clients: the right click menu is not displayed for them. X(
*[edit] What shall I do? ?(