Date
 

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

Date

Started by [T-G-T]M@sto, 05 November, 2003, 08:58:25

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[T-G-T]M@sto

Has this part anything to do with the Date in the script:
-- The timezone for your country (How many hours is the dirrerence from GMT)
gmt = "(+1 GMT)"

 textArray = {}
 QWarray = {}
 antall = 0

??????
I use FunBoTz by JenZen? but want the date to be danish like: Mandag, Tirsdag e.t.c.
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

No, that ins't the right place to look..

look for date("some textstring")

if you find it, post it here

//Skrollster

[T-G-T]M@sto

QuoteOriginally posted by Skrollster
No, that ins't the right place to look..

look for date("some textstring")

if you find it, post it here

//Skrollster
-- zFuNBoTz by JenZen?.
-- Everything in this script file is ? Copyrightet by JenZen? 2003

-- This release was meant for [DK]Burger-Banden - burger-banden.kyed.com


-- Defines the name of the bot
Bot = "[Guard]"

-- The timezone for your country (How many hours is the dirrerence from GMT)
gmt = "(+1 GMT)"

 textArray = {}
 QWarray = {}
 antall = 0


function Main()

  frmHub:RegBot(Bot)
loadText()
getLine()
SetTimer(1*60000)
StartTimer()

end

function OnTimer()
     getLine()
end


-- Triggers that will be send in the mainchat. This is triggers that are loaded from textfiles.
triggertext = {
      ["+shootafaker"]="zFuNBoTz/shootafaker.txt",
      ["+gun"]="zFuNBoTz/gun.txt",
      ["+hey"]="zFuNBoTz/hey.txt",
      ["+kaffe"]="zFuNBoTz/kaffe.txt",
      ["+weed"]="zFuNBoTz/weed.txt",
      ["+love"]="zFuNBoTz/love.txt",
      ["+morgen"]="zFuNBoTz/morgen.txt",
      ["+sleep"]="zFuNBoTz/sleep.txt",
      ["+smoke"]="zFuNBoTz/smoke.txt",
      ["+vel"]="zFuNBoTz/vel.txt",
      ["+warning"]="zFuNBoTz/warning.txt",
      ["+lol"]="zFuNBoTz/lol.txt",
      ["+delfin"]="zFuNBoTz/delfin.txt",
   }

-- Triggers that will be send in main chat. This is the triggers which have the reason text here.
Trigger = {
      ["+morgen"]=date("Good morning, [USER], today is %A the %d/%m %Y... did you know the time is %T "..gmt.."?"),
      ["+nat"]="[USER] siger godnat og sov godt! Vi ses i morgen her p? Blue Lagoon",
      ["+bed"]="[USER] siger godnat og sov godt! Vi ses i morgen her p? Blue Lagoon",
      ["+sleep"]="[USER] says good night and sleep well! See you all tomorrow at Blue Lagoon",
      ["+hey"]="Well hello hello [USER]!",
      ["+away"]="The user [USER] is going away and can not answer anymore Messages",
      ["-away"]="[USER] is back from away mode! Nice to have you back!",
      brb="Hurry up [USER] we miss you allready!",
      fuck="Heyy [USER] don't say that word!",
      ["+bye"]="See you later [USER] ( I hope )",
      lol="Loooool sq!",
      haha="Det er sq sjovt! Hehehe!",
      ["+tillykke"]="Du ?nskes TilLykke Med Dagen af [USER]! H?ber du m? f? en god dag!",
      cola="Cola?? F?j da [USER]! Hvad er det for en gang spr?jt at servere n?r man stadig kan k?be ?l!",
      wb="Welcome back!"
      
   }

-- These triggers will be sent in pm to the user. Loaded from text files
TriggerPrivate =    {
         ["+newbie"]="zFuNBoTz/newbie.txt",
         ["+nybe"]="zFuNBoTz/nybe.txt",
         ["+divx"]="zFuNBoTz/divx.txt",
         ["+adr"]="zFuNBoTz/adr.txt",
         ["+country"]="zFuNBoTz/country.txt",
         ["+gamekey"]="zFuNBoTz/gamekey.txt",
         ["+smiley"]="zFuNBoTz/forkortsmiley.txt",
         ["+moresmiley"]="zFuNBoTz/moresmiley.txt",
         ["+routerhelp"]="zFuNBoTz/routerhelp.txt",
         ["+kopiregler"]="zFuNBoTz/reglerkopiering.txt",

      }

function DataArrival(curUser, sData)

   if( strsub(sData, 1, 1) == "<" ) then
      -- get the msg only using regular expression
      s,e,msg = strfind(sData, "%b<> ([ -z]*)")
      if (msg == "+bed") then
            local text1 = ""
            readfrom("zFuNBoTz/bed1.txt")
            while 1 do
               local line = read()
               if (line == nil) then
                  break
               else
                  text1 = text1..line.."\r\n"
               end
            end
            readfrom()
            local text2 = ""
            readfrom("zFuNBoTz/bed2.txt")
            while 1 do
               local line = read()
               if (line == nil) then
                  break
               else
                  text2 = text2..line.."\r\n"
               end
            end
            readfrom()

            hey = random(1,2)
            if hey == 1 then
            SendToAll("[zFuNBoTz] - from "..curUser.sName,text1)
            elseif hey == 2 then
            SendToAll("[zFuNBoTz] - from "..curUser.sName,text2)
            end
         end



      -- look in the table
      for key, value in triggertext do
         if( strfind( strlower(msg), key) ) then
      answer, x = gsub(value, "%b[]", curUser.sName)
            local text = ""
            readfrom(answer)
            while 1 do
               local line = read()
               if (line == nil) then
                  break
               else
                  text = text..line.."\r\n"
               end
            end
            SendToAll("[zFuNBoTz] - from "..curUser.sName, text)
         end   
         readfrom()   
      end
      

      for key, value in Trigger do
         if( strfind( strlower(msg), key) ) then
            answer, x = gsub(value, "%b[]", curUser.sName)
            SendToAll( Bot, answer ) -- send bot's answer

         end
         
      end
   end
   if( strsub(sData, 1, 1) == "<" ) or ( strsub(sData, 1, 4) == "$To:") then
      s,e,msg = strfind(sData, "%b<> ([ -z]*)")
      for key, value in TriggerPrivate do
         if( strfind( strlower(msg), key) ) then
      answer, x = gsub(value, "%b[]", curUser.sName)
            local text = ""
            readfrom(answer)
            while 1 do
               local line = read()
               if (line == nil) then
                  break
               else
                  text = text..line.."\r\n"
               end
            end
            SendPmToNick(curUser.sName, Bot, text)
            
         end   
         readfrom()   
      end

end

data = strsub(sData,1,strlen(sData)-1)
s,e,cmd = strfind( data, "%b<>%s+(%S+)" )

      if (cmd=="+joke" or cmd=="!joke" or cmd=="+joke" or cmd=="-joke") then
         curUser:SendPM("[zFuNBoTz] - Joke from "..curUser.sName, txt2)
      return 1;
      end
      


      if (cmd=="!fun" or cmd=="!fun" or cmd=="+fun" or cmd=="-fun" or cmd=="+funbot" or cmd=="-funbot" or cmd=="!funbot") then
         SendPmToNick(curUser.sName, Bot, "\r\n\r\n       Current Fun commands on this hub:".."\r\n      +divx      -   Shows the DivX faq".."\r\n      +shootafaker   -    '44 Magnum Meets A Faker".."\r\n      +gun      -   BLAOW! Another Faker Bites The Dust!".."\r\n      +hey      -   Say Hello In Main Chat".."\r\n      +kaffe      -   Kaffetid!".."\r\n      +weed      -   Cheech & Chong Party Time!".."\r\n      +love      -   Groovy Kind Of Love".."\r\n      +morgen      -   Godmorgen I Hubben".."\r\n      +newbie      -   Direct Connect FAQ In English".."\r\n      +nybe      -   Direct Connect FAQ P? Dansk".."\r\n      +bed      -   Goin' To Bed".."\r\n      +smoke      -   Smokin'".."\r\n      +vel      -   Velkommen".."\r\n      +warning      -   Official Warning".."\r\n      +lol      -   Laugh Out Loud".."\r\n      +adr      -   Show Network Info".."\r\n      +away      -   Away Besked".."\r\n      -away      -   Tilbage p? hubben".."\r\n      +bye      -   Ses Senere".."\r\n      +tillykke      -   Tillykke Med Dagen".."\r\n      +nat      -   God Nat p? hubben".."\r\n      +country      -   Shows a list of all countrycodes".."\r\n      +gamekey   -   Shows keys and serials for the most popular games".."\r\n      +smiley      -   Shows some smileys and shortenings".."\r\n      +moresmiley   -   More smileys".."\r\n      +kopiregler   -   Viser de g?ldende regler for kopiering af digitale medier i DK".."\r\n      +routerhelp   -   Shows how u use active mode when you have a router or firewall".."\r\n")
               return 1;
      end


end

function tokenize (inString,token)
   _WORDS = {}
   local matcher = "([^"..token.."]+)"
   gsub(inString, matcher, function (w) tinsert(_WORDS,w) end)
   return _WORDS
end

function loadText()
handle = openfile("zFuNBoTz/joke.txt", "r")
if (handle) then
local line = read(handle)
   while line do
      if ((line ~= "") and (strfind(line, "*", 1, plain))) then
      tinsert(textArray, line)
      antall = antall + 1
   end
   line = read(handle)
   end
closefile(handle)
end
end

function getLine()
 lngWord = random(1, antall)
 QWarray = tokenize(textArray[lngWord], "*")
 txt1 = QWarray[1]
 txt2 = QWarray[2]
end
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

[T-G-T]M@sto

Can't Anyone help me with this script ?
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

the intresting line is this one:

QuoteTrigger = {
["+morgen"]=date("Good morning, [USER], today is %A the %d/%m %Y... did you know the time is %T "..gmt.."?"),
["+nat"]="[USER] siger godnat og sov godt! Vi ses i morgen her p? Blue Lagoon",

i will see if i can get som additional information on how to use date() as you might now i'm not using my regular computer right now so i don't have all my bookmarks as i'm used to..

w8, i'll be back shortly

Skrollster

I'm back and i have now found the page i was looking for:
Microsofts strftime

If you have a look here and download lua.exe

then you can start lua.exe in cmd and try out what results print(date("%A")) will give and so on...

i can't find any good and easy way to get it print the days in danish... :/

//skrollster

[T-G-T]M@sto

QuoteOriginally posted by Skrollster
I'm back and i have now found the page i was looking for:
Microsofts strftime

If you have a look here and download lua.exe

then you can start lua.exe in cmd and try out what results print(date("%A")) will give and so on...

i can't find any good and easy way to get it print the days in danish... :/

//skrollster
Thanks but i dont understand all the english word. the print(date("%A")) give me the dayname in english and i can't find any help do it on the danish part  :(  I hope someone help me out
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

#7
I'm not sure but try to specify it like this:

setlocale("den","time")
-- Triggers that will be send in main chat. This is the triggers which have the reason text here.
Trigger = {
["+morgen"]=date("Good morning, [USER], today is %A the %d/%m %Y... did you know the time is %T "..gmt.."?"),
["+nat"]="[USER] siger godnat og sov godt! Vi ses i morgen her p? Blue Lagoon",
["+bed"]="[USER] siger godnat og sov godt! Vi ses i morgen her p? Blue Lagoon",
["+sleep"]="[USER] says good night and sleep well! See you all tomorrow at Blue Lagoon",
["+hey"]="Well hello hello [USER]!",
["+away"]="The user [USER] is going away and can not answer anymore Messages",
["-away"]="[USER] is back from away mode! Nice to have you back!",
brb="Hurry up [USER] we miss you allready!",
fuck="Heyy [USER] don't say that word!",
["+bye"]="See you later [USER] ( I hope )",
lol="Loooool sq!",
haha="Det er sq sjovt! Hehehe!",
["+tillykke"]="Du ?nskes TilLykke Med Dagen af [USER]! H?ber du m? f? en god dag!",
cola="Cola?? F?j da [USER]! Hvad er det for en gang spr?jt at servere n?r man stadig kan k?be ?l!",
wb="Welcome back!"
}

[T-G-T]M@sto

#8
QuoteOriginally posted by Skrollster
I'm not sure but try to specify it like this:

setlocale("den","time")
-- Triggers that will be send in main chat. This is the triggers which have the reason text here.
Trigger = {
["+morgen"]=date("Good morning, [USER], today is %A the %d/%m %Y... did you know the time is %T "..gmt.."?"),
["+nat"]="[USER] siger godnat og sov godt! Vi ses i morgen her p? Blue Lagoon",
["+bed"]="[USER] siger godnat og sov godt! Vi ses i morgen her p? Blue Lagoon",
["+sleep"]="[USER] says good night and sleep well! See you all tomorrow at Blue Lagoon",
["+hey"]="Well hello hello [USER]!",
["+away"]="The user [USER] is going away and can not answer anymore Messages",
["-away"]="[USER] is back from away mode! Nice to have you back!",
brb="Hurry up [USER] we miss you allready!",
fuck="Heyy [USER] don't say that word!",
["+bye"]="See you later [USER] ( I hope )",
lol="Loooool sq!",
haha="Det er sq sjovt! Hehehe!",
["+tillykke"]="Du ?nskes TilLykke Med Dagen af [USER]! H?ber du m? f? en god dag!",
cola="Cola?? F?j da [USER]! Hvad er det for en gang spr?jt at servere n?r man stadig kan k?be ?l!",
wb="Welcome back!"
}
Nope that dosent help  :(  but thanks for trying
The hub crash when i add the line
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

crash, that isn't too good..

try to put the line in Main()

i'v only tried it with lua.exe and it works..

//skrollster

[T-G-T]M@sto

QuoteOriginally posted by Skrollster
crash, that isn't too good..

try to put the line in Main()

i'v only tried it with lua.exe and it works..

//skrollster
Like function Main(setlocale("dan","time")  ?
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

no like:

function Main() 
	frmHub:RegBot(Bot) 
	loadText() 
	getLine() 
	SetTimer(1*60000) 
	StartTimer() 
	setlocale("dan","time")
end

[T-G-T]M@sto

#12
QuoteOriginally posted by Skrollster
no like:

function Main() 
	frmHub:RegBot(Bot) 
	loadText() 
	getLine() 
	SetTimer(1*60000) 
	StartTimer() 
	setlocale("dan","time")
end
Nope  :(  The hub crach
Ig i only use setlocale("dan") nothing happens at all
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

try setlocale("dan", "all")

i'm just guessing now

[T-G-T]M@sto

QuoteOriginally posted by Skrollster
try setlocale("dan", "all")

i'm just guessing now
Thanks But i found the answer It WAS setlocale("dan") i just made 1 space to many  :D  Thank you M8  ;)
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

ok, so ptokax doesn't accept that we just set the time local to be our own, we have to set it all.... thanks..

[T-G-T]M@sto

QuoteOriginally posted by Skrollster
ok, so ptokax doesn't accept that we just set the time local to be our own, we have to set it all.... thanks..
AND the script need to "restart script" twice before it works and i dont know Why
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

sure?
did you save the first time??
sounds strange other...

[T-G-T]M@sto

QuoteOriginally posted by Skrollster
sure?
did you save the first time??
sounds strange other...
Yep i'm sure Try it and see - Strange but true
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

Ok, i belive you, seen strange things before..

[T-G-T]M@sto

#20
Now this date problems was solved - now we take the next step  :D
When my hub runs 24 hours and i use the trigger +morgen the script still tell me the day before. i try explain in my pure english

Friday: i use +morgen and the triggers tell me it's friday

Satrday: i use +morgen and the script tell me it's Friday  X(  

I need to "Restart script" before it's change day-
How can i make the script automatic update the date / time ?
The Ghost Riders - tgr.dyndns.org - The Best Danish Hub

Skrollster

#21
change this:
["+morgen"]=date("Good morning, [USER], today is %A the %d/%m %Y... did you know the time is %T "..gmt.."?"),

to:

["+morgen"]=function() return date("Good morning, [USER], today is %A the %d/%m %Y... did you know the time is %T "..gmt.."?") end,

*edit* or maybe don't.. hmm..

i have to think for a while now..

SMF spam blocked by CleanTalk