PtokaX forum

Archive => Archived 5.0 boards => Finished Scripts => Topic started by: ORION on 21 October, 2005, 15:26:58

Title: Butler v1.30 Released
Post by: ORION on 21 October, 2005, 15:26:58
#######################
version 1.30 has been released
See the related infomation in the later post on page 2 of this thread.

#######################

Well I have been writing a script for lua5 and Ptokax similar to butlerbot by [TLG]Matt? and have been developing it on http://lua.uknnet.com (http://lua.uknnet.com) but I have noticed this forum has a bigger user base so I thought I might upload my script here and see what people think and where I should develop it to. The script was originally written in lua4 by [TLG]Matt?  but I liked using it and wanted it in lua5 so I rewrote it and added in new fetures which I've found usefull for my own small hub. I've tested it on  PtokaX DC Hub 0.3.3.21 [debug] and seems to work fine.

Any way here's the command list for the script which gives you a quick view of what the script can do.

Butler v1.12

!help -=Shows all hub commands you have access to except for the following butler commands=-
!swelcome --=Sets Your Personal Welcome message That the hub sees=-
!sgoodbye --=Sets The Message that the hub sees when you leave the hub=-
!butlerclear --=Deleates You Saved Messages and returns them to the Defaults=-
!butlerhelp --=This Screen=-
!butlercredits -=Shows the Credits Screen for All the Great People that have helped Me=-
!shomsgs --=Shows Your saved Messages=-
!MOTD -=Shows the Message Of The Day again for your convenience=-
!news -=Shows latest news and infomation=-
!releases -=Shows latest releases in the hub=-

OP only Commands

!announce -= Same as !releases but to everyone=-
!addrelease -=Add's a new line of text to the end of the release file
!releasemessage -= add's a message to display just before releases list =-
!addnews -=Add's a new line of text to the end of the news file (can use \n to make multiple lines)
!addmotd -=Add's a new line of text to the end of the motd files (can use \n to make multiple lines)
!clearreleases -=Empties the releases file=-
!clearnews -=Empties the releases file=-
!clearmotd -=Empties the releases file=-
!clearoldreleases -= clears old releases =-
!clearreleases -= clears all releases =-
!setolddate -= changes the length in day's releases are still counted as usable =-

KNOWN bugs in v1.12
-- If you restart the script on a new day before the script can update it's internal date it becomes a day behind. (Will fix for v1.13)

Download the script package HERE v1.12 (http://www.student.uwa.edu.au/~ynemaa01/Butler(ORION%20v1.12lua5).zip)


I'm currently working on Version 1.13

-- Changes I've already completed for Version 1.13
-- Added !userstats which return to the requester a list of there current statistics
-- Added !hubinfo which shows a list of all people who have used the hub since the last !clearhubinfo was run
-- Added !clearhubinfo clears the stored hubinfo
-- Added !hubinfo <user> allows you to get the Hubinfo Stats of a particular user (Case Sensitive)
-- Added [!hubinfo Name] and [!hubinfo Time] [!hubinfo Connected] used to sort the !hubinfo list
-- Added functions stats(user), updateStats(user), userStats(user) to create the above two commands
-- Added function sortTable(iTable, sortBy) which sorts an table of tables
-- !setolddate now actually stores it's value in a file so when the script restarts the setting doesn't change
-- !addrelease now add the user name onto the end of the entry
-- Removed some unneccasary code from some functions


-- Changes I'll be working on for 1.13
-- Split the !releases command up into seperate commands for music, tv, movies, games, other.
-- anything else people want


Download the script package HERE v1.12 (http://www.student.uwa.edu.au/~ynemaa01/Butler(ORION%20v1.12lua5).zip)
Title:
Post by: Markitos on 21 October, 2005, 17:13:03
I didnt have time to test the script but why dont create a table
to add commands(functions) instead of adding many "elseif" statments???
Thats my opinion.


Cheers
Title: pm instead of main chat
Post by: MaveN on 21 October, 2005, 17:53:14
Heyy Guys Instead Of Sending The Info To The Main If I want all users to see info in pm what should i do
 
i tried,
user:SendPm(Bot,"\r\n\r\nThe hub Butler by ORION has just started\r\n")   
end

 But It did not work plz help me!!
Title:
Post by: ORION on 21 October, 2005, 18:31:12
yeh in version 1.13 I might change the commands to a table.
do you know any scripts that already do this I'd like to have a reference.


and it's SendPM(user, msg) not SendPm(user, msg)
and I might change the SendPM and main chat to be stored as a variable so you only have to change it in one spot rather than all the way through
Title:
Post by: ??????Hawk?????? on 21 October, 2005, 19:46:27
QuoteOriginally posted by ORION

and it's SendPM(user, msg) not SendPm(user, msg)
and I might change the SendPM and main chat to be stored as a variable so you only have to change it in one spot rather than all the way through

take a look  at this function  
function SendCMDData(user,msg, HowToSend)
if HowToSend then
user:SendPM(Bot,msg)
else
user:SendData(Bot,msg)
end
end

used with
How = nil  --//   set to 1 for pm

SendCMDData(user,text,How)  

??????Hawk??????
Title:
Post by: ORION on 21 October, 2005, 20:39:32
yeh I've already done something very similar to that.
But cheers anyway
Title:
Post by: Markitos on 21 October, 2005, 23:35:25
QuoteOriginally posted by ORION
yeh in version 1.13 I might change the commands to a table.
do you know any scripts that already do this I'd like to have a reference.
Yes ORION....check this site first  http://ptxwiki.psycho-chihuahua.net/doku.php/scriptinghelp/tables?s=tables
And search for entry bot by jiten, that would help u...


Cheers...
Title:
Post by: ORION on 22 October, 2005, 04:41:25
Thanks for that I'll start working on it next week I have a Animation for work to develop this weekend so I have to play around in 3D Studio max for a while
Title:
Post by: Markitos on 22 October, 2005, 10:35:21
QuoteOriginally posted by ORION
Thanks for that I'll start working on it next week I have a Animation for work to develop this weekend so I have to play around in 3D Studio max for a while
Good work 4 u!
Title:
Post by: Rick on 28 October, 2005, 22:37:34
We are having a small problem.
When people come and go it does not show a default greeting - we aren't seeing anyone coming or going

Just upgraded from your previous butler bot which was doing the job well except !butlerhelp never worked

Not complaining! But could use some direction
thanks
Rick
Title:
Post by: ORION on 29 October, 2005, 06:23:24
yes I turned off the default greeting so it'd only show a message if a person has set one otherwise it does nothing so it wouldn't flood the chat with logon/off messages. I might change it so it's an optional piece of code.
Title:
Post by: Rick on 29 October, 2005, 18:14:20
That is what we liked most about the script - that it would show who was coming and going - and identify some issues that were occuring like entering and leaving the hub every 5 minutes (due to user issues in this case)

If that becomes an optional setting that would be great

Thanks

Rick
Title:
Post by: Cêñoßy†ê on 30 October, 2005, 21:53:08
QuoteOriginally posted by ORION
yeh in version 1.13 I might change the commands to a table.
do you know any scripts that already do this I'd like to have a reference.

mayby like
tCommands["test"] = function(user, data)
user:SendMessage(tSettings.BotName, "hello!")
return 1
end
Title:
Post by: Rick on 30 October, 2005, 22:35:49
QuoteOriginally posted by ORION
yes I turned off the default greeting so it'd only show a message if a person has set one otherwise it does nothing so it wouldn't flood the chat with logon/off messages. I might change it so it's an optional piece of code.

Any way for us to turn default greetings back on?
thanks
Rick
Title:
Post by: ORION on 31 October, 2005, 07:20:04
I'll most likely be able to upload the latest version of the script some time today and it should have the default greetings option turned back on with the ability to choose to have it on or off. And most of the other things I was planning to do except the commands list
Title:
Post by: Rick on 31 October, 2005, 11:34:53
I'll be looking for it!
Thanks
Rick
Title: Version 1.13 << New Version
Post by: ORION on 31 October, 2005, 12:01:21
Well here's the new release version 1.13.
 I've tested it on  PtokaX DC Hub 0.3.3.21 [debug] and seems to work fine.

Download the script package HERE v1.13 (http://members.westnet.com.au/jacky.ynema/Butler(ORION%20v1.13lua5).zip)

Any way here's the command list for the script which gives you a quick view of what the script can do.

Butler v1.13

!help -=Shows all hub commands you have access to except for the following butler commands=-
!swelcome --=Sets Your Personal Welcome message That the hub sees=-
!sgoodbye --=Sets The Message that the hub sees when you leave the hub=-
!butlerclear --=Deleates You Saved Messages and returns them to the Defaults=-
!butlerhelp --=This Screen=-
!butlercredits -=Shows the Credits Screen for All the Great People that have helped Me=-
!shomsgs --=Shows Your saved Messages=-
!MOTD -=Shows the Message Of The Day again for your convenience=-
!news -=Shows latest news and infomation=-
!releases -=Shows latest releases in the hub=-
!daysup -=Shows how many day's the script has been running for=-
!userstats -=Shows a detail of your Stats=-
!hubinfo -=Shows a list of all people who have connected to this hub=-
!hubinfo user -=Shows specific users details (Case Sensitive)=-
!hubinfo Name -=shows !hubinfo but sorted by Name=-
!hubinfo Connected -=shows !hubinfo but sorted by No Connection=-
!hubinfo Time -=shows !hubinfo but sorted by their connected time=-

OP only Commands

!addrelease -=Add's a new line of text to the end of the release file
!releasemessage -= add's a message to display just before releases list =-
!addnews -=Add's a new line of text to the end of the news file (can use \n to make multiple lines)
!addmotd -=Add's a new line of text to the end of the motd files (can use \n to make multiple lines)
!clearreleases -=Empties the releases file=-
!clearnews -=Empties the releases file=-
!clearmotd -=Empties the releases file=-
!clearoldreleases -= clears old releases =-
!clearreleases -= clears all releases =-
!setolddate -= changes the length in day's releases are still counted as usable =-

KNOWN bugs in v1.13
-- some clients cause the client check or the stats update to try to convert a string that doesn't exist in some clients it doesn't cause any major problems but i'm trying to figure out what is actually doing it.

Download the script package HERE v1.13 (http://members.westnet.com.au/jacky.ynema/Butler(ORION%20v1.13lua5).zip)

Changes in v1.13
-- Added !userstats which return to the requester a list of there current statistics
-- Added !hubinfo which shows a list of all people who have used the hub
-- Added !hubinfo allows you to get the Hubinfo Stats of a particular user (Case Sensitive)
-- Added [!hubinfo Name] and [!hubinfo Time] [!hubinfo Connected] used to sort the !hubinfo list
-- Added functions stats(user), updateStats(user), userStats(user) to create the above two commands
-- Added function sortTable(iTable, sortBy) which sorts an table of tables
-- Added a variable to allow a choice between sending to PM or a PM in the main chat
-- Added function userCheck(user) to check client versions and active/passive mode
-- Added default Logon and Logoff messages with the option to enable/disable them
-- !setolddate now actually stores it's value in a file so when the script restarts the setting doesn't change
-- !addrelease now add the user name onto the end of the entry
-- Removed some unneccasary code from some functions

Things to change for next version
-- make commands a table rather than a series of ifelse's
-- change !releases to !movies, !music, !tv, !games, etc
-- ability to turn the stats collection on and off.
-- ability to change any of the script settings from the hub itself
Title:
Post by: Rick on 31 October, 2005, 12:06:24
Thank you so much - I am off to work but will try it this evening and post back any issues that maight come up

You efforts are appreciated

Rick
Title:
Post by: Rick on 01 November, 2005, 01:16:27
I just started 1.13 hoping it would show usersnames coming and gong. THis is what is coming up in mainchat"

[19:08] Your DC Client is approved
[19:08]    

[19:08]

Releases from previous 7 day's

There are no old releases Listed

Current Releases

There are no Current releases


[19:08]    

Not sure ...

Thanks
Rick
Title:
Post by: ORION on 01 November, 2005, 04:54:26
have you got the option set to true.

--Send default Logon and Logoff message (true or false)
   logOnOff = true

It's working fine on my hub
Title:
Post by: ORION on 01 November, 2005, 05:23:49
I've just go a PM from ** C??o?y?? **  or  Cy?e??o? not sure which it was sent from Cy?e??o? but marked as ** C??o?y?? **. Any way they have re-written the script with the commands being a big table now rather than a whole bunch of ifelses so I'm going to got through it and add in new features I've been working on and I'll release that soon
Title:
Post by: Rick on 01 November, 2005, 11:39:28
I should have come back last night and posted again

I restarted the script a couple of times and it is working great :D  It is announcing the comings and goings which is what was needed

Thanks again

Rick
Title:
Post by: ORION on 01 November, 2005, 11:50:10
okay cool.


Also ** C??o?y?? ** or Cy?e??o? have added in a right click option in the script which I didn't know was possible so when I get the new version up that'll be available too
Title:
Post by: Rick on 01 November, 2005, 12:22:21
We used to us YnHub and the chatroom feature that was built in
 Last night I had someone in a chatroom must have posted 50 "!invite"s in a row which of course don't work that way any more :P

Education - but it works great when used the RIGHT way  :rolleyes:  :P
Title:
Post by: ORION on 01 November, 2005, 13:27:19
yeh I've also added some script to the commands so when an invalid command comes up it send a message to the sender saying invalid and doesn't show up to everyone else. so if something doesn't work properly it doesn't display it to everyone unnessacarily
Title:
Post by: ORION on 01 November, 2005, 13:39:51
actually no that didn't work it just blocked out the hub software commands and made the only command that worked the ones I'd created in the script
Title: Version 1.14 Released
Post by: ORION on 13 November, 2005, 05:13:40
Well here's the new release version 1.14.
 I've tested it on  PtokaX DC Hub 0.3.3.21 [debug] and seems to work fine.

Download the script package HERE v1.14 (http://members.westnet.com.au/jacky.ynema/Butler(ORION%20v1.14lua5).zip)

Any way here's the command list for the script which gives you a quick view of what the script can do.

Butler v1.14
!help -=Shows all hub commands you have access to except for the following butler commands=-
!swelcome --=Sets Your Personal Welcome message That the hub sees=-
!sgoodbye --=Sets The Message that the hub sees when you leave the hub=-
!butlerclear --=Deleates You Saved Messages and returns them to the Defaults=-
!butlerhelp --=This Screen=-
!butlercredits -=Shows the Credits Screen for All the Great People that have helped Me=-
!shomsgs --=Shows Your saved Messages=-
!MOTD -=Shows the Message Of The Day again for your convenience=-
!news -=Shows latest news and infomation=-
!releases -=Shows All latest releases in the hub=-
!movies -=Shows latest Movie releases in the hub=-
!music -=Shows latest Music releases in the hub=-
!games -=Shows latest games releases in the hub=-
!tv -=Shows latest tv releases in the hub=-
!apps -=Shows latest apps releases in the hub=-
!others -=Shows latest other releases in the hub=-
!daysup -=Shows how many day's the script has been running for=-
!userstats -=Shows a detail of your Stats=-
!hubinfo -=Shows a list of all people who have connected to this hub=-
!hubinfo user -=Shows specific users details (Case Sensitive)=-
!hubinfo Name -=shows !hubinfo but sorted by Name=-
!hubinfo Connected -=shows !hubinfo but sorted by No Connection=-
!hubinfo Time -=shows !hubinfo but sorted by their connected time=-

OP only Commands

!addmovie -=Add's a new movie to the releases
!addmusic -=Add's new music to the releases
!addtv -=Add's a new tv episode to the releases
!addgames -=Add's a new game to the releases
!addapps -=Add's a new app to the releases
!addother -=Add's a new entry to the other releases
!releasemessage -= add's a message to display just before releases list =-
!addnews -=Add's a new line of text to the end of the news file (can use \n to make multiple lines)
!addmotd -=Add's a new line of text to the end of the motd files (can use \n to make multiple lines)
!clearreleases -=Empties the releases file=-
!clearnews -=Empties the releases file=-
!clearmotd -=Empties the releases file=-
!clearoldreleases -= clears old releases =-
!clearreleases -= clears all releases =-
!setolddate -= changes the length in day's releases are still counted as usable =-

KNOWN possible bugs in v1.14
-- some clients cause the client check or the stats update to try to convert a string that doesn't exist in some clients it doesn't cause any major problems but i'm trying to figure out what is actually doing it.

Download the script package HERE v1.14 (http://members.westnet.com.au/jacky.ynema/Butler(ORION%20v1.14lua5).zip)


Changes in Version 1.14
-- Commands now a Table (Big thanks to Cy?e??o? for doing that saved me some work)
-- Added right click Butler menu options
-- change !releases to include !movies, !music, !tv, !games, !apps, !others and !releases displays all of them
-- Changed !addreleases to !addmovies, !addmusic, !addtv, !addgames, !addapps, !addothers
Title: Problem found
Post by: ORION on 13 November, 2005, 17:16:48
I've found a problem with my script for some reason which I hope to find soon It's not storing or refreshing the tables so It erasing data apon refreshes so I'd keep with v1.13 for a little while at least.

EDIT

Well I seem to have patched it for now so anyone who downloaded it before this post was submitted may want to download it again
Title: Why not all users use !add???
Post by: Ryckarn on 14 November, 2005, 20:57:13
OP only Commands

!addmovie -=Add's a new movie to the releases
!addmusic -=Add's new music to the releases
!addtv -=Add's a new tv episode to the releases
!addgames -=Add's a new game to the releases
!addapps -=Add's a new app to the releases
!addother -=Add's a new entry to the other releases
!releasemessage -= add's a message to display just before releases list =-
!addnews -=Add's a new line of text to the end of the news file (can use \n to make multiple lines)

Can some one tells me how a can do so all people on the hub can adds this?

// Ryckarn
Title:
Post by: ORION on 14 November, 2005, 23:34:27
just change the "if SetToWho[user.iProfile] == 1 then" in each of the commands to "if SetToWho[user.iProfile] == 0 then"
so

tCommands["addmovie"] = function(user,data)
   if SetToWho[user.iProfile] == 1 then
      local s,e,cmd,args = string.find(data, "%b<>%s+(%S+)%s+(.+)")
      updateDate()
      addrelease(user, args, tMovies, "tMovies", MoviesFile)
      SaveFile(tMovies, "tMovies", MoviesFile)
   else
      sendMessage(user,Bot,"*** You dont have rights to do this command!")
   end
   return 1
end


becomes


tCommands["addmovie"] = function(user,data)
   if SetToWho[user.iProfile] == 0 then
      local s,e,cmd,args = string.find(data, "%b<>%s+(%S+)%s+(.+)")
      updateDate()
      addrelease(user, args, tMovies, "tMovies", MoviesFile)
      SaveFile(tMovies, "tMovies", MoviesFile)
   else
      sendMessage(user,Bot,"*** You dont have rights to do this command!")
   end
   return 1
end


and you could also move the relevent commands in the right click menu section
Title:
Post by: Cêñoßy†ê on 15 November, 2005, 03:23:56
or like this... now all users can use that command

tCommands["addmovie"] = function(user,data)
local s,e,cmd,args = string.find(data, "%b<>%s+(%S+)%s+(.+)")
updateDate()
addrelease(user, args, tMovies, "tMovies", MoviesFile)
SaveFile(tMovies, "tMovies", MoviesFile)
return 1
end
Title:
Post by: Ryckarn on 15 November, 2005, 18:31:31
thx....

ORION and Cy?e??o? now it?s works :)

// Ryckarn
Title: Re: Butler v1.14
Post by: Rick on 05 November, 2006, 19:46:19
I'm having a problem with 1.14
I have been adding an "other" called test then checking that it is there
If I restart the script there are no current releases - it isn't saving them
I am using the new Ptokax 0.3.5.2

Thanks

Rick
Title: Re: Butler v1.30
Post by: ORION on 12 December, 2006, 08:49:54
Well Thought I probably should upload a new version considering someone emailed me about it.
I've tested this one a bit and it seems to work fine with PtokaX 0.5.3.2 runing lua 5.1.1
Seems to be saving now upon restart.

Latest version is always up on my SVN repo
https://orion.serveftp.org/websvn/listing.php?repname=projects&path=%2Fbutler%2F#_butler_