determinate determinate

Author Topic: MessageBoard 2.0 LUA 5.1x [Strict][API 2]  (Read 6972 times)

0 Members and 1 Guest are viewing this topic.

Offline phredop

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #35 on: February 28, 2009, 07:27:50 pm »
This script is great!  Thanks for quality work again Mutor!

I would like to change the names of the commands, though, as my intention for this is more of a request bot.  How would I go about doing this?

Thanks!

Phred

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #36 on: February 28, 2009, 07:45:43 pm »
This is NOT a request bot, nevertheless many use it as such.
It does contain many of the same functions desired in a request
bot. You are free to change the command names to suit.
The commands reside in the MbCmds table near the end of the script.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline phredop

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #37 on: February 28, 2009, 08:43:50 pm »
Thanks Mutor!

I knew it wasn't for requests specifically, just wanted to know where the commands were and how to change them, thanks for that info!

Phred

Offline DeAn

  • Forum Ace
  • *****
  • Posts: 88
  • Karma: +0/-13
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #38 on: July 18, 2009, 12:47:58 pm »
Hello Guys.. Is slight modification in this script possible ?

1) There should be no new line between two messages. Even if I dont press enter after the message 1 line is left in between. Due to this less messages are shown at a glance..


Current View :
Code: [Select]
----[ 2  Board Messages ]-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 [1]  [ 07/17/09 22:37:18 ] <DeAn> Test 1

 [2]  [ 07/17/09 22:37:02 ] <DeAn> Gen-X Hub

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[ 2  Board Messages ]----


Modification Needed :
Code: [Select]
----[ 2  Board Messages ]-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 [1]  [ On 07/17/09  At  22:37:18 ] <DeAn> Test 1
 [2]  [ On 07/17/09  At  22:37:02 ] <DeAn> Gen-X Hub

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[ 2  Board Messages ]----

2) There Should be no string match case
Code: [Select]
[16:03:57] <PtokaX> I'm sorry that is too close a match to an existing entry. Last match found:

 [# 2] - [ 07/17/09 22:37:18 ] <DeAn> Gen-X Hub

3) Date-time format should be changed to  [On 07/17/09  At  22:37:02 ]  Shown above.

4) Every new message posted should carry the next alphabetical number.. and the last message posted should appear last.. [ As per the old earlier API 1 versions of Message Board ]

Code: [Select]
----[ 2  Board Messages ]-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 [1]  [ On 07/17/09  At  22:37:02 ] <DeAn> Gen-X Hub
 [2]  [ On 07/17/09  At  22:37:18 ] <DeAn> Test 1

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------[ 2  Board Messages ]----

Hope you are getting what I want to say..
I would like to have these modifications..
Thanks,

DeAn

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #39 on: July 18, 2009, 02:29:48 pm »
I code for the aesthetic I want. :P The line stays.
Do you really need that change in the time-stamp?
As for the rest I really wish you would review script
settings before you request mods. To date you have
never request a real modification. Everything has been
available through existing script options.

Code: [Select]
-- Acceptable percentage of same words allowed in new posting [set as 101 to disable]
MatchLimit = 35,
-- Descending read order? true/false [false = ascending]
Descend = true,
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline DeAn

  • Forum Ace
  • *****
  • Posts: 88
  • Karma: +0/-13
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #40 on: July 18, 2009, 06:17:01 pm »
Ok.. Time-stamp is fine..

Quote
I code for the aesthetic I want. :P The line stays.

But I want this modification [ No Space Line Between Messages ]

Like This :
Code: [Select]
----[ 2  Board Messages ]-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 [1]  [ On 07/17/09  At  22:37:18 ] <DeAn> Test 1
 [2]  [ On 07/17/09  At  22:37:02 ] <DeAn> Gen-X Hub

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

You can also tell me which line to edit.. I can do that..
Thanks,

DeAn

Offline phredop

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #41 on: September 09, 2009, 12:07:20 am »
Hello Again,

I've been looking at using this script again recently and have found something odd.  When an unregistered user joins, the user isn't sent the welcome message from the bot, is there a way to set this?

This appears to be the code that sends the user connection message, as is stated by the functions name, is there a way to edit this so as that all users are given the message?

Code: [Select]
UserConnected = function(user)
if SendMbCmds(user) then
local Prof = ProfMan.GetProfile(user.iProfile).sProfileName
local msg = "Welcome "..user.sNick..", "..Prof.."'s "..MbCfg.Script.." commands "..
"enabled. Right click hub tab or user list for menu."
Core.SendToUser(user,"<"..MbCfg.BotNick.."> "..msg.."|")
end
end
OpConnected,RegConnected = UserConnected,UserConnected

Thanks a lot!

Phred

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #42 on: September 09, 2009, 12:16:40 am »
A typical message would be:
Quote
<[MessageBoard]> Welcome Mutor, Master's MessageBoard 2.2 commands enabled. Right click hub tab or user list for menu.
This message is only sent to profiles that
have at least one script command available.
It is only to inform them of the availability of
commands. It's not a welcome message.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline phredop

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #43 on: September 09, 2009, 12:20:47 am »
Hello

I set, in the command tables, the ability for unregistered users to use commands, such as read, write and deleting their own messages.  This is why I'd like them to be able to see the message.  Is that possible?  Could the script be set to send a standard message to all users that connect?

Thanks

Phred

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #44 on: September 09, 2009, 12:25:32 am »
Why do I feel I should just repeat myself, as you have?
If you have enabled commands for unregistered
users they will get that message. It is only for
enabled profiles it is NOT for just any connecting user.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline phredop

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #45 on: September 09, 2009, 12:32:32 am »
I'm sorry to annoy, but for unregistered users, they aren't being sent the message even though they are allowed to use commands

Code: [Select]
MbCmds = {
mbwrite = {function(user,data,cmd)
if user then
local _,_,post = data:find("%b<> %p"..cmd.." (.+)|")
if not post then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <message>"
else
return WriteMsg(user,post,false)
end
else
return "Post A Message To The Board"," %[line:Message]"," %[line:Message]"
end
end,
{[-1] = true,[0] = true,[1] = true,[2] = true,[3] = true}
},
mbsticky = {function(user,data,cmd)
if user then
local _,_,post = data:find("%b<> %p"..cmd.." (.+)|")
if not post then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <sticky message>"
else
return WriteMsg(user,post,true)
end
else
return "Post A Sticky Message To The Board"," %[line:Sticky Message]"," %[line:Sticky Message]"
end
end,
{[-1] = true,[0] = true,[1] = true,[2] = true,[3] = true}
},
mbread = {function(user,data,cmd)
if user then
local _,_,lo,hi = data:find("%b<> %p"..cmd.." ([%d]-) ([%d]-)|")
if lo then lo = tonumber(lo) end
if hi then hi = tonumber(hi) end
return ReadBoard(lo,hi,nil,nil,nil,nil)
else
return "Read Board Messages"," %[line:Start Range # (Optional)] %[line:End Range # (Optional)]",
" %[line:Start Range # (Optional)] %[line:End Range # (Optional)]"
end
end,
{[-1] = true,[0] = true,[1] = true,[2] = true,[3] = true}
},
mbreadnick = {function(user,data,cmd)
if user then
local _,_,nick = data:find("%b<> %p"..cmd.." (%S+)|")
if nick then
return ReadBoard(nil,nil,nil,nick,nil,nil)
else
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <nick name>"
end
else
return "Read Board Messages For Nick"," %[line:Nickname]"," %[line:Nickname]"
end
end,
{[-1] = true,[0] = true,[1] = true,[2] = false,[3] = false}
},
mbreadmine = {function(user,data,cmd)
if user then
return ReadBoard(nil,nil,nil,user.sNick,nil,nil)
else
return "Read My Board Messages","",""
end
end,
{[-1] = true,[0] = true,[1] = true,[2] = false,[3] = false}
},
mbreaddate = {function(user,data,cmd)
if user then
local _,_,m,d,y = data:find("%b<> %p"..cmd.." (%d%d)%/(%d%d)%/(%d%d%d%d)|$")
if m and d and y then
local x = {["month"] = m,["day"] = d,["year"] = y}
local t = os.time(x)
if not t then
return "Date is out of range"
else
return ReadBoard(nil,nil,nil,nil,t,nil)
end
else
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <mm/dd/yyyy>"
end
else
return "Read Board Messages For Date"," %[line:Date in mm/dd/yyyy format]"," %[line:Date in mm/dd/yyyy format]"
end
end,
{[-1] = true,[0] = true,[1] = true,[2] = false,[3] = false}
},
mbreadrange = {function(user,data,cmd)
if user then
local _,_,nick = data:find("%b<> %p"..cmd.." (%S+)|")
local _,_,m,d,y,m2,d2,y2 = data:find("%b<> %p"..cmd.." (%d%d*)%/(%d%d*)%/(%d%d%d%d) (%d%d*)%/(%d%d*)%/(%d%d%d%d)|$")
if m and d and y and m2 and d2 and y2 then
local x,x2 = {["month"] = m,["day"] = d,["year"] = y},{["month"] = m2,["day"] = d2,["year"] = y2}
local t,t2 = os.time(x),os.time(x2)
if t and t2 then
if t > t2 then
return "Start date may not be later than end date."
else
return ReadBoard(nil,nil,nil,nil,t,t2)
end
else
local s = ""
if not t then s = "Start date is" end
if not t2 then
if s:len() == 0 then s = "End date is" else s = s.." and end date are both" end
end
return "Error! "..s.." out of range."
end
else
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <mm/dd/yyyy> <mm/dd/yyyy>"
end
else
return "Read Board Messages For Date Range",
" %[line:Start Date in mm/dd/yyyy format] %[line:End Date in mm/dd/yyyy format]",
" %[line:Start Date in mm/dd/yyyy format] %[line:End Date in mm/dd/yyyy format]"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = false,[3] = false}
},
mbquery = {function(user,data,cmd)
if user then
local _,_,query = data:find("%b<> %p"..cmd.." (.+)|")
if query then
return ReadBoard(nil,nil,query,nil,nil,nil)
else
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <search string>"
end
else
return "Search Board Messages For String"," %[line:Search String]"," %[line:Search String]"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = true,[3] = false}
},
mbdelmsg = {function(user,data,cmd)
if user then
local _,_,int = data:find("%b<> %p"..cmd.." (%d+)|")
if not int then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <message number>"
else
if BoardMessages[tonumber(int)] then
table.remove(BoardMessages,tonumber(int))
return "Message number "..int.." has been deleted."
else
return "Sorry "..user.sNick..", message number "..int.." is invalid."
end
end
else
return "Remove A Message From The Board"," %[line:Message Number]"," %[line:Message Number]"
end
end,
{[-1] = false,[0] = true,[1] = false,[2] = false,[3] = false}
},
mbdelmymsg = {function(user,data,cmd)
if user then
local _,_,int = data:find("%b<> %p"..cmd.." (%d+)|")
if not int then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <message number>"
else
if BoardMessages[tonumber(int)] then
if BoardMessages[tonumber(int)][2]:lower() == user.sNick:lower() then
table.remove(BoardMessages,tonumber(int))
return "Message number "..int.." has been deleted."
else
return "Sorry "..user.sNick..", message number "..int.." is not yours."
end
else
return "Sorry "..user.sNick..", message number "..int.." is invalid."
end
end
else
return "Remove My Message From The Board"," %[line:Message Number]"," %[line:Message Number]"
end
end,
{[-1] = true,[0] = true,[1] = true,[2] = true,[3] = true}
},
mbdelsticky = {function(user,data,cmd)
if user then
local _,_,int = data:find("%b<> %p"..cmd.." (%d+)|")
if not int then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <message number>"
else
if StickyMessages[tonumber(int)] then
table.remove(StickyMessages,tonumber(int))
return "Message number "..int.." has been deleted."
else
return "Sorry "..user.sNick..", sticky number "..int.." is invalid."
end
end
else
return "Remove A Sticky From The Board"," %[line:Sticky Number]"," %[line:Sticky Number]"
end
end,
{[-1] = false,[0] = true,[1] = false,[2] = false,[3] = false}
},
mbhelp = {function(user,data,cmd)
if user then
local reply,t,c = "\n\n\t"..MbCfg.Script.." Command Help\n\n\tCommand"..
"\t\tDescription\r\n\t"..string.rep("¯",40).."\r\n",{},""

for i,v in pairs(MbCmds) do
local desc,args = MbCmds[i][1]()
table.insert(t,"\t+"..string.format("%-15s",i).."\t"..desc.."\r\n")
end
table.sort(t, function(a,b)return a < b end)
for i,v in ipairs(t) do
c = c..v
end
if c:len() > 0 then
return reply..c.."\n\t"..string.rep("¯",40).."\r\n\r\n"
end
else
return MbCfg.Script.." Help","",""
end
end,
{[-1] = true,[0] = true,[1] = true,[2] = true,[3] = true}
}
}

I have tried to connect as an unreg user, with these privileges set and it will not send me a message upon connection, even though i have rights, as my profile is enabled to use commands.

Sorry for any confusion, or my idiocy as that very well may be the case,

Phred

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #46 on: September 09, 2009, 12:35:03 am »
That is odd because I had confirmed operation before I posted my reply.
Quote
<[MessageBoard]> Welcome Unregistered, Unregistered User's MessageBoard 2.2 commands enabled. Right click hub tab or user list for menu.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline phredop

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #47 on: September 09, 2009, 12:42:05 am »
. . . . I very well may be an idiot.  I was using version 2.0.  Updated to 2.2 and works as stated! Thanks for the awesome code!

Sorry for wasting your time Mr. Mutor : (

Phred

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #48 on: September 09, 2009, 12:43:44 am »
No problem brother. I'm glad you stepped up your version.
There were a few important changes getting to v2.2
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Yahoo

  • Lord
  • ***
  • Posts: 265
  • Karma: +32/-14
  • People Say "I Dont Know English"
    • Yahoo
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #49 on: October 23, 2009, 08:45:10 am »
Hello Mutor
i will like to have small update in the script

When a user login in the hub latest 10 post [Customize]
must be send to the user in pm/main

Thanks in Advance
« Last Edit: October 23, 2009, 08:48:25 am by Yahoo »
"BoRN FIGhTEr"

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #50 on: October 28, 2009, 09:47:27 pm »
Sir, that feature is already available in v2.2
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline gave_up_thinking

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: MessageBoard 2.2 LUA 5.1x [Strict][API 2]
« Reply #51 on: November 17, 2009, 05:48:36 am »
hello.
I liked this new v2.2 better. but i must say, there seems to be an issue.
well when you select
Code: [Select]
   -- Descending read order? true/false [false = ascending]
   Descend = true,
the posts are shown as descending all right, but the numbers are in descending too. technically it ought to be in ascending and the posts in descending.

the code will explain better:
Code: [Select]
[3]  [ 11/16/09 19:55:45 ] <NICK_1> FILE 1 shared! :)

 [2]  [ 11/16/09 22:16:18 ] <NICK_2> FILE 2 shared!

 [1]  [ 11/16/09 22:50:21 ] <NICK_3> FILE 3 Shared !!!

instead of this IMHO this would look better.

Code: [Select]
[1]  [ 11/16/09 19:55:45 ] <NICK_1> FILE 1 shared! :)

 [2]  [ 11/16/09 22:16:18 ] <NICK_2> FILE 2 shared!

 [3]  [ 11/16/09 22:50:21 ] <NICK_3> FILE 3 Shared !!!

so the message's posted latter will get a greater number that the message posted earlier.

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #52 on: November 17, 2009, 11:05:08 pm »
The number is the actual index from the table.
The table is sorted by the Descend setting.
I think it best to reflect the actual index,
rather than what you feel to 'look' better.

For the record it's NOT a release bot even if you want it to be.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #53 on: November 17, 2009, 11:07:37 pm »
Code: [Select]
--[[

MessageBoard 2.3 LUA 5.1x [Strict] [API 2]

By Mutor 12/24/07


A simple message board with stickies for the new PtokaX API
This is a complete rewrite of the script and thus a new format.
Previous message logs are incompatible with this version.

-Provides context menu [right click]
-Menus/commands permission per profile, per command
-Hub tab commands display in main, user list commands display in pm from bot.
-Option to always display in private message
-Option to display stickies or messages first
-Duplicate message/percentage same message, block feature
-Anti-advertisment option [ops protected]
-Max message cache limit. Read message limit.
-Alphabetic command listing
-Error reporting to OpNick

+Changes from 2.0 09/28/08
+Added option for ascending/descending read order requested by Yahoo

+Changes from 2.1 01/11/09
+Added option for message history at login requested by Jusper
+Added user command to toggle history [per user]

+Changes from 2.2 11/16/09
+Added 'order' to commands menus / help listing.
+Added help listing 'parameter', see below.
~Changed OnError function, option to send to OpNick or OpChat, if enabled.



MessageBoard 2.3 Command Help

Command Parameter Description
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
!mbread         <start> <end>                   Read Board Messages
!mbwrite        <message>                       Post A Message To The Board
!mbsticky       <sticky message>                Post A Sticky Message To The Board
!mbdelmsg       <message number>                Remove A Message From The Board
!mbdelmymsg     <message number>                Remove My Message From The Board
!mbdelsticky    <sticky number>                 Remove A Sticky From The Board
!mbquery        <search string>                 Search Board Messages For String
!mbreadmine                                     Read My Board Messages
!mbreadnick     <nick>                          Read Board Messages For Nick
!mbreaddate     <mm/dd/yyyy>                    Read Board Messages For Date
!mbreadrange    <start date> <end date>         Read Board Messages For Date Range
!msghistory                                     Toggle Message History At Login
!mbhelp         [this information]              MessageBoard 2.3 Help

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯



]]

MbCfg = {
-- Admin's "nick" for status / error messages ["" = Send to OpChat]
OpNick = "Mutor",
-- "Botname" ["" = hub bot]
BotNick = "[MessageBoard]",
-- Should bot have a key? true/false
BotIsOp = true,
-- Bot's description
BotDesc = "",
-- Bot Email address
BotMail = "user@domain.com",
-- "Command Menu" ["" = hub name]
Menu = "",
-- "Command SubMenu" ["" = script name]
SubMenu = "",
-- File to save messages
MsgFile = "MessageBoard23.dat",
-- File to save sticky messages
StickyFile = "StickyBoard23.dat",
-- Always reply in PM? true/false
PmOnly = true,
-- List Messages Before Stickies? true/false
MsgFirst = true,
-- Prefix Sticky Message With Time Stamp  true/false
StickyTs = true,
-- Maximum number of messages to cache
MaxCache = 500,
-- Default number of messages to read
ReadCnt = 10,
-- Enable Anti-Advertisement filtering?  true/false
AaEnabled = true,
-- Anti-Advertisement triggers
AaTrigs = {
"bounceme.net","hopto.org","myftp.biz","myftp.org","myvnc.com","no-ip.biz","no-ip.info","no-ip.org",
"redirectme.net","servebeer.com","serveblog.net","servecounterstrike.com","serveftp.com","servegame.com",
"servehalflife.com","servehttp.com","servemp3.com","servepics.com","servequake.com","sytes.net","mine.nu",
"zapto.org","blogsyte.com","cable-modem.org","ciscofreak.com","damnserver.com","ditchyourip.com",
"dnsiskinky.com","geekgalaxy.com","homesecuritymac.com","homesecuritypc.com","myactivedirectory.com",
"mymediapc.net","mypsx.net","net-freaks.com","no-ip.ca","no-ip.co.uk","no-ip.com","no-ip.net","point2this.com",
"pointto.us","quicksytes.com","securityexploits.com","securitytactics.com","serveexchange.com","servehumour.com",
"servep2p.com","servesarcasm.com","stufftoread.com","unusualperson.com","workisboring.com","dns2go","myftpsite",
},
-- Acceptable percentage of same words allowed in new posting [set as 101 to disable]
MatchLimit = 35,
-- Descending read order? true/false [false = ascending]
Descend = false,
-- Send message history to connecting users? true/false
History = true,
}

local Path = Core.GetPtokaXPath().."scripts/"
OnStartup = function()
MbCfg.Script,MbCfg.Prefixes = "MessageBoard 2.3",SetMan.GetString(29)
if MbCfg.BotNick == "" then MbCfg.BotNick = SetMan.GetString(21) end
if MbCfg.BotDesc == "" then MbCfg.BotDesc = SetMan.GetString(21).." "..MbCfg.Script end
if MbCfg.BotNick ~= SetMan.GetString(21) then
Core.RegBot(MbCfg.BotNick, MbCfg.BotDesc, MbCfg.BotMail, MbCfg.BotIsOp)
end
if MbCfg.Menu == "" then MbCfg.Menu = SetMan.GetString(0) end
if MbCfg.SubMenu == "" then MbCfg.SubMenu = MbCfg.Script end
if not MbCfg.AaEnabled then MbCfg.AaTrigs = nil end
if not MbCfg.MsgFile:find("^"..Path,1,true) then MbCfg.MsgFile = Path..MbCfg.MsgFile end
if not MbCfg.StickyFile:find("^"..Path,1,true) then MbCfg.StickyFile = Path..MbCfg.StickyFile end
MbCfg.HistoryFile = Path.."MsgHistory.dat"
if loadfile(MbCfg.MsgFile) then
dofile(MbCfg.MsgFile)
else
BoardMessages = {}
SaveFile(MbCfg.MsgFile,BoardMessages,"BoardMessages")
end
if loadfile(MbCfg.StickyFile) then
dofile(MbCfg.StickyFile)
else
StickyMessages = {}
SaveFile(MbCfg.StickyFile,StickyMessages,"StickyMessages")
end
if loadfile(MbCfg.HistoryFile) then
dofile(MbCfg.HistoryFile)
else
History = {}
SaveFile(MbCfg.HistoryFile,History,"History")
end
MbCfg.Order = {"mbread","mbwrite","mbsticky","mbdelmsg","mbdelmymsg","mbdelsticky",
"mbquery","mbreadmine","mbreadnick","mbreaddate","mbreadrange","msghistory","mbhelp"}
OnError(MbCfg.Script.." ".._VERSION.." by Mutor has been started, using "..Mem().." of memory.")
end

OnExit = function()
OnError(MbCfg.Script.." ".._VERSION.." by Mutor has been stopped. Freeing "..Mem().." of memory.")
end

OnError = function(msg)
if msg and msg:len() > 0 then
if msg:sub(-1,-1)~= "|" then msg = msg.."|" end
if MbCfg.OpNick and MbCfg.OpNick ~= "" then
local user = Core.GetUser(MbCfg.OpNick)
if user then Core.SendToUser(user,"<"..MbCfg.BotNick.."> "..msg) end
else
local x = SetMan.GetOpChat().bEnabled
if x then
Core.SendToOpChat("<"..MbCfg.BotNick.."> "..msg)
else
Core.SendPmToOps(MbCfg.Bot,msg)
end
end
end
end

UserConnected = function(user)
if SendMbCmds(user) then
local Prof = "Unregistered User"
if user.iProfile ~= -1 then Prof = ProfMan.GetProfile(user.iProfile).sProfileName end
local msg = "Welcome "..user.sNick..", "..Prof.."'s "..MbCfg.Script.." commands "..
"enabled. Right click hub tab or user list for menu."
Core.SendToUser(user,"<"..MbCfg.BotNick.."> "..msg.."|")
end
local Chk = function(n) for i,v in ipairs(History) do if n:lower() == v:lower() then return true end end end
if next(BoardMessages) and MbCfg.History and Chk(user.sNick) then
local sfx = "\r\n\r\n\tType "..MbCfg.Prefixes:sub(1,1).."msghistory to toggle this pm on/off"
local lo,hi = 1,math.min(MbCfg.ReadCnt,#BoardMessages)
local msg = ReadBoard(lo,hi,nil,nil,nil,nil)..sfx
Core.SendPmToUser(user,MbCfg.BotNick,msg.."|")
end
end
OpConnected,RegConnected = UserConnected,UserConnected

ChatArrival = function(user,data)
local _,_,cmd = data:find("%b<> ["..MbCfg.Prefixes.."](%a+)")
if cmd and MbCmds[cmd] and MbCmds[cmd][2][user.iProfile] then
if MbCfg.AaEnabled and not Core.GetUserValue(user,11) then
for _,v in ipairs(MbCfg.AaTrigs) do
if data:lower():find(v:lower(),1,1) or data:find("%d-%.%d-%.%d-%.%d-") then
return Core.SendToAll("<"..MbCfg.BotNick.."> Let's all laugh at "..
user.sNick..", who tried and failed to advertise on the message board." ),true
end
end
end
local reply = MbCmds[cmd][1](user,data,cmd)
if reply and reply ~= "" then
local _,_,to = data:find("^$To: (%S+) From:")
if to and to == MbCfg.BotNick or MbCfg.PmOnly then
Core.SendPmToUser(user,MbCfg.BotNick,reply.."|")
else
Core.SendToUser(user,"<"..MbCfg.BotNick.."> "..reply.."|")
end
end
return true
end
end
ToArrival = ChatArrival

Mem = function() collectgarbage("collect") return string.format("%-.2f Kb.",collectgarbage("count")) end

ReadBoard = function(from,to,query,auth,date,daterange)
local arg = ""
local z
if auth or query or date then
if query then arg = "For Search String: "..query elseif auth then arg = "For Author: "..auth end
z = true
from,to = 1,#BoardMessages
end
if not from then from = 1 else z = true end
if not to then to = math.min(from + MbCfg.ReadCnt,#BoardMessages) else to = math.min(to,#BoardMessages) end
local sret,ret,m,s,x,result = {},{},"","","-",""
if not z and next(StickyMessages) then
for i,v in ipairs(StickyMessages) do
if date or daterange then
local d1,d2 = os.date("%x",v[3]):gsub("%D",""),os.date("%x",date):gsub("%D","")
if daterange then
d3 = os.date("%x",daterange):gsub("%D","")
if d1 >= d2 or d1 <= d3 then
s = s.." ["..i.."]  "..v[1].."\n"
table.insert(sret,{i," ["..i.."]  "..v[1].."\n"})
end
else
if d1 == d2 then table.insert(sret,{i," ["..i.."]  "..v[1].."\n"}) end
end
elseif auth then
if v[2]:lower():find(auth:lower(),1,true) then
table.insert(sret,{i," ["..i.."]  "..v[1].."\n"})
end
elseif not query or v[1]:gsub("^.+> ",""):find(query) then
table.insert(sret,{i," ["..i.."]  "..v[1].."\n"})
end
end
end
if next(BoardMessages) then
for i = from, to do
if date then
arg = "For: "..os.date("%x",date)
local d1,d2 = os.date("%x",BoardMessages[i][3]):gsub("%D",""),os.date("%x",date):gsub("%D","")
if daterange then
arg = arg.." To: "..os.date("%x",daterange)
d3 = os.date("%x",daterange):gsub("%D","")
if d1 >= d2 or d1 <= d3 then
table.insert(ret,{i," ["..i.."]  "..BoardMessages[i][1].."\n\n"})
end
else
if d1 == d2 then
table.insert(ret,{i," ["..i.."]  "..BoardMessages[i][1].."\n\n"})
end
end
elseif auth then
if BoardMessages[i][2]:lower():find(auth:lower(),1,true) then
table.insert(ret,{i," ["..i.."]  "..BoardMessages[i][1].."\n\n"})
end
elseif not query or BoardMessages[i][1]:gsub("^.+> ",""):find(query) then
arg = tostring(to - from + 1).." Messages"
table.insert(ret,{i," ["..i.."]  "..BoardMessages[i][1].."\n\n"})
end
end
end
if #ret > 0 then
if MbCfg.Descend then table.sort(ret, function(a,b) return a[1] > b[1] end) end
for i,v in ipairs(ret) do m = m..v[2] end
result = "\n\n----[ "..tostring(#ret).."  Board Messages ]"..x:rep(175).."\n\n"..m..x:rep(175).."[ "..tostring(#ret).."  Board Messages ]----\n"
end
if #sret > 0 then
if MbCfg.Descend then table.sort(sret, function(a,b) return a[1] > b[1] end) end
for i,v in ipairs(sret) do s = s..v[2] end
local so = "\n\n----[ "..tostring(#sret).."  Sticky Messages ]"..x:rep(175).."\n"..s..x:rep(175).."[ "..tostring(#sret).."  Sticky Messages ]----\n"
if MbCfg.MsgFirst then result = result..so else result = so..result end
end
if result:len() > 0 then return "Results: "..arg..result else return "No matching entries found." end
end

WriteMsg = function(user,msg,sticky)
if MbCfg.AaEnabled and not Core.GetUserValue(user,11) then
for _,v in ipairs(MbCfg.AaTrigs) do
if msg:lower():find(v:lower(),1,1) or msg:find("%d-%.%d-%.%d-%.%d-") then
return "Invalid string detected: "..string.format("%q",v)..". You may not advertise here."
end
end
end
local check,reply = CheckMsg(msg,sticky)
if check then
return "I'm sorry that is too close a match to an existing entry. Last match found:\n\n"..
" [# "..check.."] - "..reply.."\n\n"
else
local msgtype = "board message"
local prof = "Unregistered User"
if user.iProfile ~= -1 then
prof = ProfMan.GetProfile(user.iProfile).sProfileName
end
local msgprefix = "[ "..os.date().." ] <"..user.sNick.."> "
if sticky then
msgtype = "sticky message"
if MbCfg.StickyTs then
table.insert(StickyMessages,1,{msgprefix:gsub("<","%1"..prof.." ")..msg,user.sNick,os.time()})
else
table.insert(StickyMessages,1,{msgprefix:gsub("^%b[] <","<"..prof.." ")..msg,user.sNick,os.time()})
end
SaveFile(MbCfg.StickyFile,StickyMessages,"StickyMessages")
else
table.insert(BoardMessages,1,{msgprefix..msg,user.sNick,os.time()})
SaveFile(MbCfg.MsgFile,BoardMessages,"BoardMessages")
end
while #BoardMessages > MbCfg.MaxCache do table.remove(BoardMessages,#BoardMessages) end
local reply = prof.." "..user.sNick.." just posted a "..msgtype..
" to the message board. Type "..MbCfg.Prefixes:sub(1,1).."mbread to read messages."
Core.SendToAll("<"..MbCfg.BotNick.."> "..reply.."|")
return prof.." "..user.sNick..", your "..msgtype.." was successfully posted."
end
end

CheckMsg = function(msg,sticky)
local T = BoardMessages
if sticky then T = StickyMessages end
if next(T) then
msg = msg:lower(msg)
for i,v in ipairs(T) do
local txt = v[1]:lower():gsub("^%[.-%] ","")
--Exact match, case insensitive
if txt:lower() == msg:lower() then return i,v[1] end
--Match anywhere within message, case insensitive
if txt:lower():find(msg:lower()) then return i,v[1] end
--Run a loop to find percentage of match
local len,cnt = 0,0
for word in txt:gmatch("%S+") do
len = len + 1
if msg:lower():find(word,1,1) then cnt = cnt + 1 end
end
local pct = (cnt/len) * 100 or 0
if pct >= MbCfg.MatchLimit then return i,v[1].." String match: "..string.format("%.2f%%",pct) end
end
end
end

SendMbCmds = function(user)
local u,p,m,s,t,c = "$UserCommand 1 ",MbCfg.Prefixes:sub(1,1),MbCfg.Menu,MbCfg.SubMenu,{},""
for i,v in ipairs(MbCfg.Order) do
if MbCmds[v][2][user.iProfile] then
local desc,arg1,arg2 = MbCmds[v][1]()
c = c..u.."1 "..m.."\\"..s.."\\"..desc.."$<%[mynick]> "..p..v..arg1.."&#124;|"..
u.."2 "..m.."\\"..s.."\\"..desc.."$$To: "..MbCfg.BotNick.." From: %[mynick] "..
"$<%[mynick]> "..p..v..arg2.."&#124;|"
end
end
if c ~= "" then Core.SendToUser(user,c) Mem() return true end
Mem()
end

MbCmds = {
mbwrite = {function(user,data,cmd)
if user then
local _,_,post = data:find("%b<> %p"..cmd.." (.+)|")
if not post then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <message>"
else
return WriteMsg(user,post,false)
end
else
return "Post A Message To The Board"," %[line:Message]"," %[line:Message]","<message>"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = true,[3] = true}
},
mbsticky = {function(user,data,cmd)
if user then
local _,_,post = data:find("%b<> %p"..cmd.." (.+)|")
if not post then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <sticky message>"
else
return WriteMsg(user,post,true)
end
else
return "Post A Sticky Message To The Board"," %[line:Sticky Message]",
" %[line:Sticky Message]","<sticky message>"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = true,[3] = true}
},
mbread = {function(user,data,cmd)
if user then
local _,_,lo,hi = data:find("%b<> %p"..cmd.." ([%d]-) ([%d]-)|")
if lo then lo = tonumber(lo) end
if hi then hi = tonumber(hi) end
return ReadBoard(lo,hi,nil,nil,nil,nil)
else
return "Read Board Messages"," %[line:Start Range # (Optional)] %[line:End Range # (Optional)]",
" %[line:Start Range # (Optional)] %[line:End Range # (Optional)]","<start> <end>"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = true,[3] = true}
},
mbreadnick = {function(user,data,cmd)
if user then
local _,_,nick = data:find("%b<> %p"..cmd.." (%S+)|")
if nick then
return ReadBoard(nil,nil,nil,nick,nil,nil)
else
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <nick name>"
end
else
return "Read Board Messages For Nick"," %[line:Nickname]"," %[line:Nickname]","<nick>"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = false,[3] = false}
},
mbreadmine = {function(user,data,cmd)
if user then
return ReadBoard(nil,nil,nil,user.sNick,nil,nil)
else
return "Read My Board Messages","","",""
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = false,[3] = false}
},
mbreaddate = {function(user,data,cmd)
if user then
local _,_,m,d,y = data:find("%b<> %p"..cmd.." (%d%d)%/(%d%d)%/(%d%d%d%d)|$")
if m and d and y then
local x = {["month"] = m,["day"] = d,["year"] = y}
local t = os.time(x)
if not t then
return "Date is out of range"
else
return ReadBoard(nil,nil,nil,nil,t,nil)
end
else
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <mm/dd/yyyy>"
end
else
return "Read Board Messages For Date"," %[line:Date in mm/dd/yyyy format]",
" %[line:Date in mm/dd/yyyy format]","<mm/dd/yyyy>"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = false,[3] = false}
},
mbreadrange = {function(user,data,cmd)
if user then
local _,_,nick = data:find("%b<> %p"..cmd.." (%S+)|")
local _,_,m,d,y,m2,d2,y2 = data:find("%b<> %p"..cmd.." (%d%d*)%/(%d%d*)%/(%d%d%d%d) (%d%d*)%/(%d%d*)%/(%d%d%d%d)|$")
if m and d and y and m2 and d2 and y2 then
local x,x2 = {["month"] = m,["day"] = d,["year"] = y},{["month"] = m2,["day"] = d2,["year"] = y2}
local t,t2 = os.time(x),os.time(x2)
if t and t2 then
if t > t2 then
return "Start date may not be later than end date."
else
return ReadBoard(nil,nil,nil,nil,t,t2)
end
else
local s = ""
if not t then s = "Start date is" end
if not t2 then
if s:len() == 0 then s = "End date is" else s = s.." and end date are both" end
end
return "Error! "..s.." out of range."
end
else
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <mm/dd/yyyy> <mm/dd/yyyy>"
end
else
return "Read Board Messages For Date Range",
" %[line:Start Date in mm/dd/yyyy format] %[line:End Date in mm/dd/yyyy format]",
" %[line:Start Date in mm/dd/yyyy format] %[line:End Date in mm/dd/yyyy format]",
"<start date> <end date>"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = false,[3] = false}
},
mbquery = {function(user,data,cmd)
if user then
local _,_,query = data:find("%b<> %p"..cmd.." (.+)|")
if query then
return ReadBoard(nil,nil,query,nil,nil,nil)
else
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <search string>"
end
else
return "Search Board Messages For String"," %[line:Search String]",
" %[line:Search String]","<search string>"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = true,[3] = false}
},
mbdelmsg = {function(user,data,cmd)
if user then
local _,_,int = data:find("%b<> %p"..cmd.." (%d+)|")
if not int then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <message number>"
else
if BoardMessages[tonumber(int)] then
table.remove(BoardMessages,tonumber(int))
return "Message number "..int.." has been deleted."
else
return "Sorry "..user.sNick..", message number "..int.." is invalid."
end
end
else
return "Remove A Message From The Board"," %[line:Message Number]",
" %[line:Message Number]","<message number>"
end
end,
{[-1] = false,[0] = true,[1] = false,[2] = false,[3] = false}
},
mbdelmymsg = {function(user,data,cmd)
if user then
local _,_,int = data:find("%b<> %p"..cmd.." (%d+)|")
if not int then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <message number>"
else
if BoardMessages[tonumber(int)] then
if BoardMessages[tonumber(int)][2]:lower() == user.sNick:lower() then
table.remove(BoardMessages,tonumber(int))
return "Message number "..int.." has been deleted."
else
return "Sorry "..user.sNick..", message number "..int.." is not yours."
end
else
return "Sorry "..user.sNick..", message number "..int.." is invalid."
end
end
else
return "Remove My Message From The Board"," %[line:Message Number]",
" %[line:Message Number]","<message number>"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = true,[3] = true}
},
mbdelsticky = {function(user,data,cmd)
if user then
local _,_,int = data:find("%b<> %p"..cmd.." (%d+)|")
if not int then
return "Error!, Usage: "..MbCfg.Prefixes:sub(1,1)..cmd.." <message number>"
else
if StickyMessages[tonumber(int)] then
table.remove(StickyMessages,tonumber(int))
return "Message number "..int.." has been deleted."
else
return "Sorry "..user.sNick..", sticky number "..int.." is invalid."
end
end
else
return "Remove A Sticky From The Board"," %[line:Sticky Number]",
" %[line:Sticky Number]","<sticky number>"
end
end,
{[-1] = false,[0] = true,[1] = false,[2] = false,[3] = false}
},
msghistory = {function(user,data,cmd)
if user then
local Chk = function(n)
for i,v in ipairs(History) do if n:lower() == v:lower() then return i end end
return false
end
local status,result,x = "added to","You will now receive message history at login.",Chk(user.sNick)
if x then
table.remove(History,x)
status,result = "removed from","You will no "..
"longer receive message history at login."
else
table.insert(History,user.sNick)
end
SaveFile(MbCfg.HistoryFile,History,"History")
return "You have been "..status.." the history table. "..result
else
return "Toggle Message History At Login","","",""
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = true,[3] = true}
},
mbhelp = {function(user,data,cmd)
if user then
local reply,t,p,c = "\n\n\t"..MbCfg.Script.." Command Help\n\n\tCommand"..
"\t\tParameter\t\t\tDescription\r\n\t"..string.rep("¯",75).."\r\n",{},MbCfg.Prefixes:sub(1,1),""
for i,v in ipairs(MbCfg.Order) do
if MbCmds[v][2][user.iProfile] then
local desc,_,_,parm = MbCmds[v][1]()
local ts = "\t"
if #parm < 8 then ts = "\t\t" end
c = c.."\t"..p..string.format("%-15s",v).."\t"..
string.format("%-40.35s",parm)..ts..desc.."\r\n"
end
end
if c:len() > 0 then return reply..c.."\n\t"..string.rep("¯",75).."\r\n\r\n" end
else
return MbCfg.Script.." Help","","","[this information]\t"
end
end,
{[-1] = false,[0] = true,[1] = true,[2] = true,[3] = true}
}
}

Serialize = function(tTable, sTableName, hFile, sTab)
sTab = sTab or "";
hFile:write(sTab..sTableName.." = {\n" )
for key, value in ipairs(tTable) do
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
hFile:write( sTab.."}")
end

SaveFile = function(file,table, tablename )
local hFile = io.open (file , "wb")
Serialize(table, tablename, hFile)
hFile:close()
collectgarbage("collect")
end
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline gave_up_thinking

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: MessageBoard 2.2 LUA 5.1x [Strict][API 2]
« Reply #54 on: November 18, 2009, 04:42:24 am »
The number is the actual index from the table.
The table is sorted by the Descend setting.
I think it best to reflect the actual index,
rather than what you feel to 'look' better.

For the record it's NOT a release bot even if you want it to be.

With all respect Mutor, I meant that the posts that are added later on will have a 'greater value' than the posts already posted to the MsgBoard. So with each new message the count of messages will go on increasing and the greatest no. message will be the last one posted on the board.
In previous MsgBoard scripts (API 1) I've seen this happen, so was confused as to why new API 2 scripts gave the opposite order!
I tried the 2.3 version, still the same.
If I'm not able to explain myself to you, please say so ::), I will post again with a detailed message for understanding.

Sincerely.

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #55 on: November 19, 2009, 09:52:42 am »
Your are confusing the value with the index.
If you're asking why messages are added to
the beginning of the table and not the end,
that too, was by request. I see no reason
to change this. But feel free to do so.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline gave_up_thinking

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: MessageBoard 2.2 LUA 5.1x [Strict][API 2]
« Reply #56 on: November 19, 2009, 05:39:52 pm »
@Mutor allrighty, my bad. I should have read the whole thread attentively before accusing you ;D
I will look into it and edit accordingly (help me if I mess up ;) )

PS: I guess the previous messages will have to be deleted in order to have the index as per my new wish?!

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #57 on: November 20, 2009, 11:41:51 am »
Exactly and that's why I waited for change to new API before granting the request.
It's not huge changes in code, but you will want to attend to add remove and purging functions.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline Yahoo

  • Lord
  • ***
  • Posts: 265
  • Karma: +32/-14
  • People Say "I Dont Know English"
    • Yahoo
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #58 on: July 17, 2010, 07:37:12 am »
this is my all tym fav script
all thanks to mutor :D
"BoRN FIGhTEr"

Offline Black-Dragon

  • Member
  • ***
  • Posts: 34
  • Karma: +0/-3
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #59 on: May 10, 2011, 11:32:06 am »
[11:40] Sintassi [string "--[[..."]:111: attempt to index global 'Core' (a nil value)

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: MessageBoard 2.0 LUA 5.1x [Strict][API 2]
« Reply #60 on: May 13, 2011, 01:20:53 am »
This script is only for PtokaX 0.3.6.4d and later.
Given that, don't use the check syntax button, just start the script.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

 

determinate determinate