PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: NemeziS on 08 March, 2005, 17:34:43

Title: Topic scrolling
Post by: NemeziS on 08 March, 2005, 17:34:43
Hi, guys!

Is it possible to write a script that will scroll my hub Name and Topic in left direction? I want it to be shown on the top of DC++ programm in my hub like Hubname and topic.

Thanx a lot!  :)

Best regards,
NemeziS
Title:
Post by: bastya_elvtars on 08 March, 2005, 17:49:14
Available, but takes a lot of b/w. I will make it anyway later (or who is the faster lol)
Title:
Post by: bastya_elvtars on 08 March, 2005, 18:11:17
This keeps rebuildinfg the topic banner. :)function Main()
SetTimer(1000)
StartTimer()
char=0
end

function GetBanner()
hubname=frmHub:GetHubName()
topic=frmHub:GetHubTopic()
chartab={}
banner=hubname.." -  "..topic
-- leng=string.len(banner)
end

function OnTimer()
GetBanner()
char=char+1
if char < string.len(banner) then
SendToAll("$HubName "..string.sub(banner,1,char))
elseif char > string.len(banner) and char < string.len(banner)*2 then
SendToAll("$HubName "..string.sub(banner,-(string.len(banner)-char)))
else
SendToAll("$HubName "..banner)
end
end
Title:
Post by: b_w_johan on 08 March, 2005, 18:17:25
its not working here ..
is this for latest version of ptokax ???
cause if it is can it be made for the old one to cause i liked that idea ..

or is it for in DC client wich supports lua scripting ??

didn't looked that much to it but is it possible to set the speed ??

so it is going 1 letter every 10 sec or every 1 hour for example ...

greetings Johan
Title:
Post by: b_w_johan on 08 March, 2005, 18:20:43
Syntax error: attempt to call field `GetHubTopic' (a nil value)
stack traceback:
   1:  function `GetBanner' at line 9 [file `...ER.000\Bureaublad\2gb minshare\scripts\test.lua']
   2:  function `OnTimer' at line 16 [file `...ER.000\Bureaublad\2gb minshare\scripts\test.lua']

thats the error i get ...

but there is a topic ...
Title:
Post by: bastya_elvtars on 08 March, 2005, 18:28:39
Another version:

-- set refresh time (speed) here. decimals are allowed.

secs=1




function Main()
SetTimer(secs*1000)
StartTimer()
char=0
end

function GetBanner()
hubname=frmHub:GetHubName()
topic=frmHub:GetHubTopic()
chartab={}
banner=hubname.." -  "..topic
-- leng=string.len(banner)
end

function OnTimer()
GetBanner()
char=char+1
if char < string.len(banner) then
SendToAll("$HubName "..string.sub(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

These are for ptokax 16.05.
Title:
Post by: b_w_johan on 08 March, 2005, 19:02:00
Syntax error: attempt to call field `GetHubTopic' (a nil value)
stack traceback:
   1:  function `GetBanner' at line 16 [file `...ER.000\Bureaublad\2gb minshare\scripts\test.lua']
   2:  function `OnTimer' at line 23 [file `...ER.000\Bureaublad\2gb minshare\scripts\test.lua']


again that error ...

i guess its not working on 0.3.3.0-15.18(don't ask me why i use that version i don't now ... have 5 versions now =-p ill test the newest version in a short time but i think most of my scrtipts wont work .....)
Title:
Post by: bastya_elvtars on 08 March, 2005, 19:21:33
QuoteOriginally posted by bastya_elvtars
These are for ptokax 16.05.

* commits a suicide soon, as post last till the start of the next one *
Title:
Post by: NemeziS on 08 March, 2005, 19:58:38
Thanx, bastya_elvtars! I just modified and tested the script and it works fine now. You should create Topic.txt file in your scripts folder to make the script work.

topicFile = "Topic.txt"
topic = nil
hubname = ""

secs=1/4 -- set refresh time (speed) here. decimals are allowed.

function Main()
SetTimer(secs*1000)
StartTimer()
char=0
end

function OnTimer()
hubname = frmHub:GetHubName()

  handle = openfile(topicFile, "r")
  if (handle) then
    topic = read(handle)
    closefile(handle)
  end

chartab={}

char=char+1
if char < strlen(topic) then
SendToAll("$HubName "..hubname.." ** [   "..strsub(topic,char,strlen(topic)))
elseif char > strlen(topic) and char < strlen(topic)*2 then
SendToAll("$HubName "..hubname.." ** [    "..strsub(topic,-(strlen(topic)-char)))
else
char=0
end
end

Enjoy!

Best regards,
NemeziS
Title:
Post by: bastya_elvtars on 08 March, 2005, 20:29:18
Yes, if there's no topic, it will crash. THX for report!
Title:
Post by: bastya_elvtars on 08 March, 2005, 21:38:24
You did not notice that PtokaX has lua5 scripting now. I wrote this for lua5, complete script here (http://board.univ-angers.fr/thread.php?threadid=3855&boardid=26&styleid=1&sid=1c7d4e37ac995663e49444868a745249&page=1#2).
Title:
Post by: plop on 09 March, 2005, 01:04:05
johan click here (http://board.univ-angers.fr/thread.php?threadid=3864&boardid=2&styleid=1&page=1#1)

plop
Title:
Post by: b_w_johan on 09 March, 2005, 09:03:54
plop youre link is not working ...

Error Message
Invalid data!

Greetings Johan