PtokaX forum

Archive => Archived 5.1 boards => Finished Scripts => Topic started by: Cêñoßy†ê on 22 March, 2006, 10:57:46

Title: BirthDayMan
Post by: Cêñoßy†ê on 22 March, 2006, 10:57:46
--- BirthdayMan v 3.5
--- by Herodes -- Update 5/10/2004
--- Converted to Lua 5 by jiten (some ideas taken from BirthdayMan v 2.6 LUA_5.0 by TT and Jelf)
--- --- --- --- --- ---
-- v2.5
--- When Users are connected if there is a birthday it informs
--- When a Birhtday-User connect it plays surprise and informs the Hub
-- v2.6
--- Fix from ... comment for the display age
-- v 3
--- ability to display the Birthday nicks in the topic of the hub ... ( all of them ... the Ofline ones are in parentheses like (Herodes))
--- added agecmd to get exact age
--- added bhelpcmd
--- added display of birthdays in the findcmd
--- added ability for pm or main cmds .. ;)
-- v3.5
--- added integration of zodiac signs in various parts of the script
--- added celebrities birthdays with a switch to load or not the file
--- added celebcmd ,... works like findcmd but for celebrities
--- added switch for displaying birthday in topic
-- Small mod by C??o?y?? 21/03/2006
--- removed celebrity part
--- removed You Are a xxxxx!!!  when someone adds b-day
--- added rightclick
--- added option to reg or unreg bot in userlist
--- removed TopicShow from settings (mayby forgotten thing there,allready was titshow)
--- changed settings table little more to my taste :P
--- Made needed changes to run with Ptokax DC Hub 0.3.4.0c



Download BirthDayMan v3.5 [cMod] (http://ptxscriptdb.psycho-chihuahua.net/download.php?view.206)
Title: Birthday Man v4.08 - LUA 5.0/5.1
Post by: jiten on 12 April, 2006, 09:50:13
--[[

Birthday Man v.4.08 - LUA 5.0/5.1 by jiten (11/29/2007)
?????????????????????????????????????????????????????
Based on: BirthdayMan v 3.5 by Herodes and mods by C??o?y??

CHANGELOG:
??????????
Rewritten: Whole code;

Changed: Command structure to tables (Function, Permissions, RightClick and Description);
Changed: B-Day table structure to Julian values;
Removed: File content that was sent on B-Day;
Removed: Allowed Age;
Removed: Topic updater (maybe in the future);
Changed: Whole B-Day counting system to os.*;
Changed: Commands returned according to input (Main or PM);
Changed: Many other mods that can't recall at the moment (4/12/2006);
Added: addbirthday command - requested by TT (4/13/2006);
Fixed: Zodiac Sign Dates - thanks to Walazo;
Changed: Error message on empty !bornon result - thanks to Walazo;
Changed: !birthdays' content structure to fix bad tabbing;
Changed: Settings.iVer;
Added: string.lower checks - thanks to Walazo (4/14/2006)
Fixed: !bornon Year function - thanks to Walazo
Added: sNick to keep original nick - requested by TT (4/15/2006);
Changed: *t to !*t;
Fixed: Birthday is at midnight - reported by TT (6/25/2006)
Added: Send Text File content - requested by TT (7/6/2006)
Added: Hub Topic updater - requested by UwV (7/11/2006)
Added: Celebrity's feature - requested by UwV (7/15/2006)
Fixed: BDayCheck function - reported by TT (7/16/2006)
Fixed: Added correct tabbing for messy !birthdays - reported by [NL]_Yvisaur and UwV;
Changed: !birthdays is sorted from Jan to Dez - requested by UwV;
Added: Details and 'All' field to !bornon command - requested by UwV;
Added: Common fields to !celeb command - requested by UwV (7/24/2006)
Added: %ptodaybirthdays - requested by Yahoo (11/28/2007)

]]--
Title: Re: BirthDayMan
Post by: TiMeTrAVelleR on 12 April, 2006, 14:11:30
when 2 users have same date  you get this
[15:08:57] <-T?M????-> *** Error: I already have Birthday on May 16, 1966! If it wasn't correctly set, ask Operators for help!

greetzz TT
Title: Re: BirthDayMan
Post by: jiten on 12 April, 2006, 16:01:58
Quote from: T?M??r?V?ll?R on 12 April, 2006, 14:11:30
when 2 users have same date? you get this
[15:08:57] <-T?M????-> *** Error: I already have Birthday on May 16, 1966! If it wasn't correctly set, ask Operators for help!

greetzz TT

This error will occur if the user has already added its Birthday to the DB.

In this version, there isn't an option to add another user's B-day. Is that your case/request?
Title: Re: BirthDayMan
Post by: jiten on 12 April, 2006, 18:05:18
Maybe I didn't explain it well, but, the error reported by TT doesn't really happen, as you can see:

Quote
[19:00:18] <B-Day> *** Your Birthday is on July 25, 1983! I didn't know you were a Leo!
[19:00:18] <B-Day> *** New Birthday added by jiten on: 25/07/1983

[19:00:45] <B-Day> *** Your Birthday is on July 25, 1983! I didn't know you were a Leo!
[19:00:45] <B-Day> *** New Birthday added by test on: 25/07/1983

[19:01:42] <B-Day>
   =================================================================================
   Nr.   Birthdate:         Weekday:   Zodiac Sign:   Status:      Name:
   ------------------------------------------------------------------------------------------------------------------------------------------------------------------
   1   July 25, 1983      Monday      Leo      *Online*      test
   2   July 25, 1983      Monday      Leo      *Online*      jiten
Title: Re: BirthDayMan
Post by: TiMeTrAVelleR on 12 April, 2006, 20:45:01
you where right i added part to add other users mysel;f and then you get the error   when i log in whit other nick and do that its np

sorry about that

greetzz TT
Title: Re: BirthDayMan
Post by: jiten on 12 April, 2006, 21:19:04
Quote from: T?M??r?V?ll?R on 12 April, 2006, 20:45:01
you where right i added part to add other users mysel;f and then you get the error? ?when i log in whit other nick and do that its np

sorry about that

greetzz TT


No problem, TT :)
Title: Birthday Man v.4.01 - LUA 5.0/5.1
Post by: jiten on 13 April, 2006, 10:56:48
First post updated with TT's request.
Title: Re: BirthDayMan
Post by: TiMeTrAVelleR on 13 April, 2006, 12:13:12
thanks  great job  :D

Title: Birthday Man 3.x - 4.x DB Converter
Post by: jiten on 13 April, 2006, 20:05:55
As requested, and for those that may need this:

--[[

Birthday Man 3.x - 4.x DB Converter by jiten (4/15/2006)

Requested by: T?M??r?V?ll?R

Changelog:

- Changed: string.lowered index;
- Added: sNick to each index (4/15/2006)

1. Place your old birthdays.tbl under your scripts' folder;
2. Run this script and the new file "tBirthday.tbl" will appear in the same folder;
3. And that's it!

]]--

tConvert = {}

Main = function()
local tmp; dofile("birthdays.tbl")
for i,v in pairs(tBirthdays) do
if v[3] < 1970 then tmp = 1970 - v[3]; v[3] = 1970 else tmp = 0 end
local tTable = { day = v[1], month = v[2], year = v[3] }
tConvert[string.lower(i)] = { sNick = i, iJulian = os.time(tTable), iAdjust = tmp }
end
local hFile = io.open("tBirthday.tbl","w+") Serialize(tConvert,"tBirthday",hFile); hFile:close()
end

Serialize = function(tTable,sTableName,hFile,sTab)
sTab = sTab or "";
hFile:write(sTab..sTableName.." = {\n");
for key,value in pairs(tTable) do
if (type(value) ~= "function") then
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
if(type(value) == "table") then
Serialize(value,sKey,hFile,sTab.."\t");
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
hFile:write(sTab.."\t"..sKey.." = "..sValue);
end
hFile:write(",\n");
end
end
hFile:write(sTab.."}");
end
Title: Re: BirthDayMan
Post by: TiMeTrAVelleR on 13 April, 2006, 21:28:06
thanks worked great

greetzz TT
Title: Birthday Man v.4.02 - LUA 5.0/5.1
Post by: jiten on 14 April, 2006, 08:11:15
First post has been updated with some changes.
Title: Re: BirthDayMan
Post by: TiMeTrAVelleR on 14 April, 2006, 10:46:57
yep looks nicer  :D
Title: Re: BirthDayMan
Post by: 6Marilyn6Manson6 on 14 April, 2006, 10:49:18
Very nice work jiten ;)
Title: Birthday Man v.4.03 - LUA 5.0/5.1
Post by: jiten on 15 April, 2006, 14:11:50
First post updated once more with some bugfixes.

Attention: The old .tbl must be deleted before using this version, as its index must be in lower-case.

I've also updated the 3.x - 4.x converter to fix this issue.
Title: Birthday Man v.4.04 - LUA 5.0/5.1
Post by: jiten on 15 April, 2006, 17:52:04
First post updated with a small, yet important change in the code (requested by TT):

In 4.03, nicks were saved to the DB in lower-case. Therefore, when displayed by the script wouldn't look the same.

Attention: You must delete your .old tbl before using this version.

I've also updated the 3.x - 4.x DB converter to support this.
Title: Birthday Man v.4.05 - LUA 5.0/5.1
Post by: jiten on 25 June, 2006, 18:41:15
First post updated with a small, yet important change in the code (reported by TT):

In the older 4.0x versions, birthdays only counted from 12 am. So, this version fixes this 'huge' bug.

Attention: You must delete your .old tbl before using this version.

I'm attaching a Birthday Man 4.01-04 to 4.05 Database Converter to this post, so that you can convert you current DB's content to the new format.
Title: Birthday Man v.4.051 - LUA 5.0/5.1
Post by: jiten on 07 July, 2006, 20:47:08
First post has been updated with an addition [requested by TT] to the main code.

Title: Re: BirthDayMan
Post by: UwV on 09 July, 2006, 13:54:50
hi Jilten   great work .. looking very good. :0)
just i am still using  a "slightly modded" version 3.5 (with !celebs with show you are a "zodiacsign", topicchanger etc. etc.
now i was wondering .. would you mind to add those nice extra's again ?..
obviously this one still has the 'bugs' not solved since that version .. (in other word this script works perfect, no errors)

i will attach the version that  i use (+ celebstable) it would be really nice if you could add that back in again ..

... for  my own mod's  i will add them back in myself offcourse (nagging  etc.)
Title: Re: BirthDayMan
Post by: jiten on 09 July, 2006, 17:15:06
Quote from: UwV on 09 July, 2006, 13:54:50
now i was wondering .. would you mind to add those nice extra's again ?..
i will attach the version that? i use (+ celebstable) it would be really nice if you could add that back in again ..

Sure. I'll add them as soon as possible.

Best regards
Title: Birthday Man v.4.061 - LUA 5.0/5.1
Post by: jiten on 16 July, 2006, 12:33:38
First post has been updated with some changes:


CHANGELOG:
??????????
Added: Hub Topic updater - requested by UwV (7/11/2006)
Added: Celebrity's feature - requested by UwV (7/15/2006)
Fixed: BDayCheck function - reported by TT (7/16/2006)
Title: Re: BirthDayMan
Post by: [NL]_Yvisaur on 16 July, 2006, 15:14:16
hi

I want to transolate this script to dutch
it's all going good. but with the !birthdays command it's a mess  ;)

click for picture (http://www.ivoniftrik.nl/ivo/verjaardagsbot.jpg)

is it possible to get this good?
Title: Re: BirthDayMan
Post by: jiten on 16 July, 2006, 19:17:47
Quote from: [NL]_Yvisaur on 16 July, 2006, 15:14:16
but with the !birthdays command it's a mess? ;)

click for picture (http://www.ivoniftrik.nl/ivo/verjaardagsbot.jpg)

is it possible to get this good?

In your tCommands' table, replace the existing 'birthdays' sub-table with this one:

birthdays = {
tFunc = function(user)
if next(tBirthday) then
local sMsg, n = "\r\n\t"..string.rep("=", 105).."\r\n\tNr.\tStatus:\t\tZodiac Sign:\tWeekday:"..
"\tBirthdate:\t\t\tName:\r\n\t"..string.rep("-", 210).."\r\n", 0
for i, v in pairs(tBirthday) do
local sStatus, sTab = "*Offline*", "\t"
n = n + 1; if GetItemByName(i) then sStatus= "*Online*" end;
local sDate, sWDay, sZodiac = tFunctions.JulianToDate(v)
if string.len(sZodiac) < 8 then sTab = "\t\t" end
sMsg = sMsg.."\t"..n..".\t"..sStatus.."\t\t"..sZodiac..sTab..sWDay.."\t\t"..sDate..
"\t\t"..v.sNick.."\r\n"
end
user:SendMessage(Settings.sBot, sMsg)
else
user:SendMessage(Settings.sBot, "*** Error: There are no saved Birthdays!")
end
end,
tLevels = {
[-1] = 1, [0] = 1, [1] = 1, [2] = 1, [3] = 1, [4] = 1, [5] = 1,
},
sDesc = "\t\tShows all Birthdays",
tRC = "Show all B-Days$<%[mynick]> !{}"
},
Title: Re: BirthDayMan
Post by: [NL]_Yvisaur on 16 July, 2006, 21:15:44
it's super now  ;D

ty Jiten!
Title: Re: BirthDayMan
Post by: UwV on 17 July, 2006, 10:06:37
Quote from: jiten on 16 July, 2006, 12:33:38
First post has been updated with some changes:


CHANGELOG:
??????????
Added: Hub Topic updater - requested by UwV (7/11/2006)
Added: Celebrity's feature - requested by UwV (7/15/2006)
Fixed: BDayCheck function - reported by TT (7/16/2006)


thanks Jilten
Title: Re: BirthDayMan
Post by: jiten on 18 July, 2006, 12:07:39
I'm glad you guys like it.

And don't mention it, you're welcome.
Title: Re: BirthDayMan
Post by: UwV on 18 July, 2006, 14:35:42
but i insist sir,..

THANK YOU !!!

;)
Title: Re: BirthDayMan
Post by: UwV on 19 July, 2006, 10:44:13
working A-ok ..

just " Sagittarius "    (in Microsoft sans serif  8 )  is too long so needs a small edit here.

and i miss the "full celeb info" (it used to show  all (same day nr, same moth, same year, same day month and year)

and a small request .. could  birthday list be sorted ?
like first one to have b-day on top and last one in bottom ?
or just sorted byt b-day like..   jan 1 on top dec 31 in bottom ..


all else look great :0) database converters work A-ok very very nice work :0)))
Title: Re: BirthDayMan
Post by: UwV on 19 July, 2006, 11:01:05
small thing or ?..

=========================================================================================================
People born in the same "Field" as yours:
Field: Nick:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Year UwV2; _Saartje_
Day UwV2
Month Notox; PurpleHaze; [Rus]Elpa; UwV2; [Tele2][10mbitTele2]tripsun; _tntns_



i have exact same b- day as UwV2  .. but it doesn't show the "all" field ..
or is this not supposed to ?

and yet another request (my requests are just requests i can mod it myself offcourse)
in the new layout (wich really does look good) i kindda miss the deatails mabye ..

Year UwV2 25/12/1971 ; _Saartje_ 04/04/1971
Day UwV2 25/12/1971
Month ; _tntns_ 10/11/68; UwV2 25/12/1971 ;

would be nice ?

and i see "findsame" is still "same-same" for the findbday so the celebs could be like that too ?

*edit ..
or in other words ..
can we see both on both ?
like it shows the same celebs now i would like to see that on same user bday too
and the way it shows same user bday  show on same celebs  too ..
Title: Re: BirthDayMan
Post by: jiten on 19 July, 2006, 12:05:35
Quote from: UwV on 19 July, 2006, 10:44:13
just " Sagittarius "? ? (in Microsoft sans serif? 8 )? is too long so needs a small edit here.

and i miss the "full celeb info" (it used to show? all (same day nr, same moth, same year, same day month and year)

and a small request .. could? birthday list be sorted ?

i have exact same b- day as UwV2 .. but it doesn't show the "all" field ..

in the new layout (wich really does look good) i kindda miss the deatails mabye ..

Yes, this can be done and will be fixed/added in the next update.
Title: Re: BirthDayMan
Post by: UwV on 19 July, 2006, 12:24:16
thanks .. is really nice    :0)

Title: Re: BirthDayMan
Post by: BrotherBear on 19 July, 2006, 19:15:05
Thanks jiten for another great Script :)
Title: Birthday Man v.4.07 - LUA 5.0/5.1
Post by: jiten on 28 July, 2006, 13:32:29
First post has been updated with some changes:


CHANGELOG:
??????????
Fixed: Added correct tabbing for messy !birthdays - reported by [NL]_Yvisaur and UwV;
Changed: !birthdays is sorted from Jan to Dez - requested by UwV;
Added: Details and 'All' field to !bornon command - requested by UwV;
Added: Common fields to !celeb command - requested by UwV (7/24/2006)
Title: Re: BirthDayMan
Post by: 6Marilyn6Manson6 on 28 July, 2006, 14:39:51
First to download it :D
Title: Re: BirthDayMan
Post by: UwV on 28 July, 2006, 21:55:58
thanks again :0)
Title: Re: BirthDayMan
Post by: baba.runner on 04 January, 2007, 21:25:58
Hi jiten

Thx for this amazing script.

I just have one question or one little reuqest.
When I enter a b-day for tommorrow is it normal that in the topic it also apears the day after, as there is now B-day specified for that day.

here my settings:
Settings = {
-- Bot's Name
sBot = "???xcalibur?Burzeltag??",
-- Script version
iVer = "4.07",
-- Register in userlist
bReg = false,

-- Send File Content (true = on, false = off)
bSendText = true,
-- Birthday Text File
fText = "cake.txt",

-- Update hub topic (true = on, false = off)
bUpdateTopic = true,
-- Use Celebrity's command (true = on, false = off)
bCelebrity = true,

-- Minimum allowed year
iMin = 1900,
-- Time to check for B-Dayers (in hours)
iTime = 12,
-- B-Day Man DB
fBirth = "tBirthday.tbl",
-- Celebrity's DB
fCelebrity = "tCelebrity.tbl"


and where do I have to put this cake.txt?

Thanks in advance for your assistance.
Title: Re: BirthDayMan
Post by: Yahoo on 19 March, 2007, 15:44:00
can some make a small change in Birthday Man v.4.07
can some create a command which will show the birthday(s) of all the users sharing or having on that day for eg
+birthdays
<bot> Today's Birthdays:yahoo,mutor
Title: Re: BirthDayMan
Post by: Yahoo on 27 November, 2007, 13:10:08
the above mentioned request is not possible???
Title: Re: BirthDayMan
Post by: Yahoo on 28 November, 2007, 09:21:16
i had requested this long back (19-03-2007, 15:44:00) but the author did not responded
Cant any other scripter edit the script for me please
Title: Re: BirthDayMan
Post by: jiten on 28 November, 2007, 18:02:20
Quote from: Yahoo on 28 November, 2007, 09:21:16
i had requested this long back (19-03-2007, 15:44:00) but the author did not responded
Cant any other scripter edit the script for me please

I didn't reply because I wasn't around at the time.

As stated by Mutor, your request can be done. I'll update the script soon.
Title: Re: BirthDayMan
Post by: Yahoo on 29 November, 2007, 09:05:24
thanks sir

i will be w8ing for the updated version
Title: Birthday Man v.4.08 - LUA 5.0/5.1
Post by: jiten on 29 November, 2007, 15:44:33
First post has been updated:


CHANGELOG:
??????????
Added: %ptodaybirthdays - requested by Yahoo (11/28/2007)
Title: Re: BirthDayMan
Post by: Yahoo on 29 November, 2007, 18:30:22
Thanks Jiten the script is working great

but one more small request
i will like to have a small change if a user has not entered his birthday in the database he must get a private message on join like Please Enter your Birthday in Database of this hub by using the command +addbirthday dd/mm/yyyy

and he must get this message on every connect with the hub until he enter his birthday in the database
Title: Re: BirthDayMan
Post by: -SkA- on 22 January, 2008, 14:02:10
Hello,

great work but now I need this script to be converted in API 2.

Already tried with hungarista's converter but it shows many errors...  :(

Thank you!  ;D
Title: Re: BirthDayMan
Post by: speedX on 22 January, 2008, 19:12:07
Hello,
I have converted this script to NEW API using Hungarista's converter and fixed those errors, please test it and tell me if you get any bugs. Currently this script send all messages in main only. In a few days I'll amend it and make it working in both main as well as PM.
Title: Re: BirthDayMan
Post by: baba.runner on 14 March, 2008, 20:52:53
Hello speedX hello jiten

I tried to use this converted script but it does not show any RC. currently I'm using PX 4.0.0b
Can you please review this conversion and perhaps post a corrected version.

Thanks in advance.

KR.
baba.runner
Title: Re: BirthDayMan
Post by: jiten on 15 March, 2008, 00:22:30
Quote from: baba.runner on 14 March, 2008, 20:52:53
Hello speedX hello jiten

I tried to use this converted script but it does not show any RC. currently I'm using PX 4.0.0b
Can you please review this conversion and perhaps post a corrected version.

Thanks in advance.

KR.
baba.runner

I will look into this issue and post a PX 0.4.0.0 compatible version soon.

Best regards
Title: Re: BirthDayMan
Post by: jiten on 15 March, 2008, 20:36:25
Quote from: baba.runner on 14 March, 2008, 20:52:53
I tried to use this converted script but it does not show any RC. currently I'm using PX 4.0.0b
Can you please review this conversion and perhaps post a corrected version.

Try replacing your existing UserConnected function with this one:

UserConnected = function(user)
-- Supports UserCommands
if Core.GetUserValue(user, 12) then
for i, v in pairs(tCommands) do
if v.tLevels[user.iProfile] then
local sRC = string.gsub(v.tRC, "{}", i)
Core.SendToNick(user.sNick,"$UserCommand 1 3 B-Day Bot\\"..sRC.."&#124;")
end
end
end
-- Check B-Days on connect
tFunctions.BDayCheck("OnConnect", user)
end
Title: Re: BirthDayMan
Post by: baba.runner on 16 March, 2008, 09:51:55
Quote from: jiten on 15 March, 2008, 20:36:25
Try replacing your existing UserConnected function with this one:

UserConnected = function(user)
-- Supports UserCommands
if Core.GetUserValue(user, 12) then
for i, v in pairs(tCommands) do
if v.tLevels[user.iProfile] then
local sRC = string.gsub(v.tRC, "{}", i)
Core.SendToNick(user.sNick,"$UserCommand 1 3 B-Day Bot\\"..sRC.."&#124;")
end
end
end
-- Check B-Days on connect
tFunctions.BDayCheck("OnConnect", user)
end


Hello jiten

That works fine.

Thousand thanks m8

KR
baba.runner