PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: kepp on 07 January, 2004, 00:01:48

Title: Liv?-Tim?r
Post by: kepp on 07 January, 2004, 00:01:48
--// Live Timer By Kepp
--//
--// Im not so sure how much
--// recources this neat script use
--// So use with brain!!!

RemHub = "[BBB][Sweden[Network]"

function Main()
      SetTimer(1000)
      StartTimer()
end

function OnTimer()
      frmHub:SetHubName(RemHub)
      local arg = date("%H:%M:%S")
      local arg2 = frmHub:GetHubName()
      local OutPut = arg2.." - The Time Is : "..arg
      frmHub:SetHubName(OutPut)
      SendToAll("$HubName "..OutPut)
end
Title:
Post by: DoJIN on 07 January, 2004, 00:34:48
nice ....

whut it do?
Title:
Post by: BlazeXxX on 07 January, 2004, 01:10:04
nice one but wen u have bit less memory, its skipping seconds.. like after 24:30:12 it goes like 24:30:14
Title:
Post by: kepp on 07 January, 2004, 07:03:54
like i said... it may use alot, maybe not... i haven't experience any problems but that may be because im huge on memory
Title:
Post by: c h i l l a on 08 January, 2004, 14:09:11
nice idea kepp...

just you can do this a little simpler

--// Live Timer By Kepp
--//
--// Im not so sure how much
--// recources this neat script use
--// So use with brain!!!

RemHub = "[BBB][Sweden[Network]"

function Main()
      frmHub:SetHubName(RemHub)
      SetTimer(1000)
      StartTimer()
end

function OnTimer()
      SendToAll("$HubName "..RemHub.." - The Time Is : "..date("%H:%M:%S"))
end

since you update the hub name every second anyways..
you actually don't even need to reg it at Main()

but I agree, maybe better set the timer to a minute, so when your hub is laggy, or the time till one gets the message differs. each second, won't make much difference.
Title:
Post by: kepp on 08 January, 2004, 14:35:19
:O lol... Nice one..
makes me feel stupid..
I noticed a little delay myself today so yea, i would say every minute or so, maybe 30 sec.
Title:
Post by: yepyepyep4711 on 08 January, 2004, 15:51:17
hey guys, just for the sake of it: how about a Timer-Bot, called "time", for example, which Description would show the time. You know, like the away-bot that actualises the description with your away status.

I just think that could be a nice challenge.

On this very bot: I'm using it now ;) but I replaced the original "time is" with my former Hub-Topic. So my suggestion: could you replace the "time is" by an argument that would be the hubtopic, and maybe read it from the hub, or if not possible, integrate the !topic command in the script, so that it would still be possible to change the topic using !topic in the mainchat?

I hope you get me :)

cheers
Title:
Post by: c h i l l a on 08 January, 2004, 16:40:09
one thing..  like this :))

--Live Timer bot by kepp
--Idea yepyepyep4711
--modded me.

bot = "TimE"

function Main()
frmHub:RegBot(bot)
SetTimer(1*1000)
StartTimer()
end

function OnTimer()
SendToAll("$MyINFO $ALL "..bot.." Local Time : "..date("%H:%M:%S").."$ $"..date("%H:%M:%S").."$Local Time : "..date("%H:%M:%S").."$$|")
end
Title:
Post by: c h i l l a on 08 January, 2004, 16:48:18
take 2

--Live Timer by kepp
--Idea yepyepyep4711
--modded me.

HubName = frmHub:GetHubName()

topic = "type !topic "

function Main()
      SetTimer(1*1000)
      StartTimer()
end

function OnTimer()
      SendToAll("$HubName "..HubName.." - "..topic.." - Local Time : "..date("%H:%M:%S"))
end

function DataArrival(curUser,data)
if curUser.bOperator and strsub(data,1,1) == "<" then
local _,_,cmd,curtopic = strfind( data, "%b<>%s(%S+)%s+(.*)%|$" )
if cmd and cmd == "!topic" then
topic = curtopic
curUser:SendData("Topic has been set to "..topic..".")
SendToAll("$HubName "..HubName.." - "..topic.." - Local Time : "..date("%H:%M:%S"))
return 1
end
end
end
Title:
Post by: Woody on 09 January, 2004, 23:39:07
Great Idea you guys
Title:
Post by: Woody on 10 January, 2004, 01:06:12
c h i l l a
i was wondering could you make it so the topic stayed permanent rather that you being able to change it using cmd !topic ??????
Title:
Post by: kepp on 10 January, 2004, 01:12:56
You want the topic to stay the same after restarting hub or something?
Title:
Post by: Woody on 10 January, 2004, 01:16:22
yeh!

or

Can it be changes so that you have an option withing the .lua that ou change it by, no commands
Title:
Post by: kepp on 10 January, 2004, 01:18:18
im not sure what you want, can you explain a little more specific!?
Title:
Post by: Woody on 10 January, 2004, 01:23:49
--Live Timer by kepp
--Idea yepyepyep4711
--modded me.

HubName = frmHub:GetHubName()

topic = "type !topic "

function Main()
      SetTimer(1*1000)
      StartTimer()
end

function OnTimer()
      SendToAll("$HubName "..HubName.." - "..topic.." - Local Time : "..date("%H:%M:%S"))
end

function DataArrival(curUser,data)
   if curUser.bOperator and strsub(data,1,1) == "<" then
      local _,_,cmd,curtopic = strfind( data, "%b<>%s(%S+)%s+(.*)%|$" )
      if cmd and cmd == "!topic" then
         topic = curtopic
         curUser:SendData("Topic has been set to "..topic..".")
         SendToAll("$HubName "..HubName.." - "..topic.." - Local Time : "..date("%H:%M:%S"))
         return 1
      end
   end
end


the topic, you are able to change it rite?? by using the command !topic

What i want (if possible) is for the topic to be permanent, and have no ability to change it through commands.

only have the ability to change it throught the .lua, asif it was a bot name??????

now do u get me????
Title:
Post by: kepp on 10 January, 2004, 01:23:58
--Live Timer by kepp
--Idea yepyepyep4711
--modded me.

HubName = frmHub:GetHubName()

topic = "type !topic "

function Main()
      SetTimer(1*1000)
      StartTimer()
end

function OnTimer()
      SendToAll("$HubName "..HubName.." - "..topic.." - Local Time : "..date("%H:%M:%S"))
end


function DataArrival(curUser,data)
if curUser.bOperator and strsub(data,1,1) == "<" then
local _,_,cmd,curtopic = strfind( data, "%b<>%s(%S+)%s+(.*)%|$" )
if cmd and cmd == "!topic" then
topic = curtopic
         frmHub:SetHubName(topic)
curUser:SendData("Topic has been set to "..topic..".")
SendToAll("$HubName "..HubName.." - "..topic.." - Local Time : "..date("%H:%M:%S"))
return 1
end
end
end

Set topic once and it should be there forever
Title:
Post by: Woody on 10 January, 2004, 01:26:56
unfortunatly, when the hub restarts, you still have to re enter the topic

and whatever you entered as the topic is now the hub name
Title:
Post by: kepp on 10 January, 2004, 01:33:49
Oh, i see


--Live Timer by kepp

--Idea yepyepyep4711

--modded me.



HubName = frmHub:GetHubName().." - "..topic.." - Local Time :"

topic = "Topic text here"

function Main()
      SetTimer(1*1000)

      frmHub:SetHubName(HubName)

      StartTimer()
end



function OnTimer()
      SendToAll("$HubName "..HubName.." "..date("%H:%M:%S"))
end

This should do it
Title:
Post by: Woody on 10 January, 2004, 01:40:58
nope still with a hub restart, the topic resets itself
Title:
Post by: plop on 10 January, 2004, 01:49:10
try sending the same as on the timer on function main and on connecting users.

plop
Title:
Post by: kepp on 10 January, 2004, 01:53:10
--Live Timer by kepp

--Idea yepyepyep4711

--modded me.



HubName = frmHub:GetHubName().." - "..topic.." - Local Time :"

topic = "Topic text here"

function Main()
      SetTimer(1*1000)

      frmHub:SetHubName(HubName)

      SendToAll("$HubName "..HubName.." "..date("%H:%M:%S"))

      StartTimer()
end



function OnTimer()
      SendToAll("$HubName "..HubName.." "..date("%H:%M:%S"))
end


function NewUserConnected(user)
      SendToAll("$HubName "..HubName.." "..date("%H:%M:%S"))
end


function OpConnected(user)
      NewUserConnected(user)
end

Thanks for the tip Plop, let's hope this work :)
Title:
Post by: Woody on 10 January, 2004, 01:54:56
i have no idea how to edit .lua

plop how did u learn???

btw i get

Syntax Error: attempt to concat global `topic' (a nil value)

whatever that means ?????
Title:
Post by: kepp on 10 January, 2004, 02:07:53
--Live Timer by kepp
--Idea yepyepyep4711
--modded me.

topic = [[Topic text here]]

HubName = frmHub:GetHubName().." - "..topic.." - Local Time :"

function Main()

      SetTimer(1*1000)

      frmHub:SetHubName(HubName)

      SendToAll("$HubName "..HubName.." "..date("%H:%M:%S"))

      StartTimer()
end


function OnTimer()

      SendToAll("$HubName "..HubName.." "..date("%H:%M:%S"))
end



function NewUserConnected(user)

      SendToAll("$HubName "..HubName.." "..date("%H:%M:%S"))
end

function OpConnected(user)

      NewUserConnected(user)
end

Try now, I actually tested it this time :P
Title:
Post by: plop on 10 January, 2004, 02:51:26
QuoteOriginally posted by Woody
i have no idea how to edit .lua
plop how did u learn???
well ehm, the day before a trip 2 my g/f i browsed the lua site a bit and found a book there.
during the 1st week of that holiday i read about 50-75% of that book in the rare few moments i was alone.
came home and looked on this forum for some scripts witch i knew had bugs (more then 1 pref).
i tryed 2 fix them bug for bug myself, after 2-3 scripts like that i started 2 make my 1st kick counter.
gues you can say i learned just by trail and error, making lots and lots of mistakes.
and have 2 say that i learned really a lot from the help of notrabitwombat.
he gave me hints not straigth answers, i love that as you learn a lot more that way.
i'm still learning myself everyday, everytime i try 2 do things in another way.
i don't really feel comfy when ppl call me smart, i rather say i'm creative.
if i know some1 is trying 2 learn lua i try just 2 give hints, kepp knows that by now.
if you wanne learn it 2 i'll try 2 remember your name and do the same with you (hope also the other folks whill do or start doing that).

plop

the place where you can download that book is posted here on the forum somewhere a couple times, keep forgetting it myself. (should be the proof that i'm not smart. lol)
Title:
Post by: kepp on 10 January, 2004, 03:05:38
QuoteOriginally posted by plop
QuoteOriginally posted by Woody
i have no idea how to edit .lua
plop how did u learn???
well ehm, the day before a trip 2 my g/f i browsed the lua site a bit and found a book there.
during the 1st week of that holiday i read about 50-75% of that book in the rare few moments i was alone.
came home and looked on this forum for some scripts witch i knew had bugs (more then 1 pref).
i tryed 2 fix them bug for bug myself, after 2-3 scripts like that i started 2 make my 1st kick counter.
gues you can say i learned just by trail and error, making lots and lots of mistakes.
and have 2 say that i learned really a lot from the help of notrabitwombat.
he gave me hints not straigth answers, i love that as you learn a lot more that way.
i'm still learning myself everyday, everytime i try 2 do things in another way.
i don't really feel comfy when ppl call me smart, i rather say i'm creative.
if i know some1 is trying 2 learn lua i try just 2 give hints, kepp knows that by now.
if you wanne learn it 2 i'll try 2 remember your name and do the same with you (hope also the other folks whill do or start doing that).

plop

the place where you can download that book is posted here on the forum somewhere a couple times, keep forgetting it myself. (should be the proof that i'm not smart. lol)

Yea... You learn alot to browse these forums, getting hints from plop, read the manual, and have fun... :)

by the way.. The book is also here (http://theabyss2.no-ip.org:8080/luabook.pdf)
Title:
Post by: bastya_elvtars on 31 May, 2004, 23:29:58
maby im an idiot but the last posted one does not change the topic on !topic...
Title:
Post by: Herodes on 31 May, 2004, 23:42:53
Doen't have to do with any command ... look for your self ... :)
No DataArrival function in there ...
It is meant to sent (the hub Name - the time )
That means it is sending the $Hubname string every second ... (bandwidth)
if u want u can change
...
function Main()

      SetTimer(1*1000)  <=-to-=>  SetTimer(60*1000)
seconds ^^^------------------minutes ^^^

and as u are in Notepad press Ctrl+H and replace :
date("%H:%M:%S"))      <=-to-=>  date("%H:%M"))

So it sents only the minutes ....  
Let's code ... :)