Message Board for Ptokax 3.3.21 + - Page 2
 

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

Message Board for Ptokax 3.3.21 +

Started by effgjamis, 15 September, 2005, 22:52:29

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blackwings

#25
sorry I meant =
0 = master
1 = operator
2 = vip
3 = reg
4 = moderator (not a default ptokax profile)
5 = netfounder (not a default ptokax profile)
-1 = normal/unregisterd users

4 and 5 isn't default profiles, you must have gotten it from when you upgraded from the old ptokax to
the new one (0.3.3.0 b16.04 and later), or you use robocop.

explaination of  rprofiles[user.iProfile]==1 then   =

if users profile match with a index in variable rprofiles and has a value that is 1,
then do whatever code that is within the "if" and "end".

you are consider to be a normal user if you have no account in ptokax.
All users that hasn't an account is a normal user = -1.


Madman

QuoteOriginally posted by blackwings
QuoteOriginally posted by kunal
the cmds work only in pm not in main.
also the cmds only work for operators.
Why in main, pm is only needed. But madman can surely fix it for you ;)

Yup.. post has been updated..
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p


effgjamis

QuoteOriginally posted by blackwings

explaination of  rprofiles[user.iProfile]==1 then   =


You have done it again, F A N T A S T I C ... for your explanation in allowing me to have more insight of this stuff.. thanks.

Not real sure that this next question/request, would be proper here or not, but here goes.

"In looking at the script I see, such as (user.iProfile), Data Names (Variables), which are not defined within the script itself" Therefore, I take it that the HUB (Ptokax) has the Data Names (Variables) defined and one could access hub information via those Data Names (variables), which I would now call " API " (Application Program Interface)".

So,, the question is, where would one get the API, Ptokax (protocol, Data Names, variables, etc. ) list/documentation ??  I am not sure I asked the question correctly as I am not sure as to get that infomation which is provided by the Ptokax Hub for scripting or ????

Thanks again for your gracious assistance.. VERY MUCH appreciated..

Have a great day
<<<--- Eff --->>>
Curious Mind would like to know..

blackwings

for ptokax lua api, check =
http://ptxwiki.psycho-chihuahua.net/doku.php

and also check this file in ptokax main folder =
Scripting-Interface.txt


effgjamis

Madman....... BlackWing

I wish to thank you for your skills in working with the MsgBoard script. Between you and BlackWing, you both are performing way beyond the call.. I thank you for that.

Yep,, you are right,, I do have a question.

As of this writing, I have yet to see any results from my exercising the commands to write/read , etc. but I get no syntax errors and Ptokax does load. ( one issue I see, is that I do not get a name for the script in the User Nick list of the client unless I substitute in FrmHub:Regbot  (Bot)  as FrmHub:Regbot ("PostBox"). and even then via PM or Main Chat, I get no response, nor any thing posted in the file, (messageBoard.txt).

However, states "kunal" it is working. Soooo, I guess my
question is:

Do I need some supporting drivers, *dll, etc, runtime moduals or ??, which are preventing the script to function for me??

 I am running Windows 2000 Pro (up to date via Msft), Ptokax 3.3.21 (debug), Terminator V5, (However, I turn Terminator off and on to ensure it is not causing my problem). I have no other scripts running or even installed, excepting those that installed with Ptokax. Oh.. Msft netframework 1.1 is installed.

Thanks again, I appreciate all that has been accomplished and the curve of learning that I have gained from this experience..and I do hope you don't mind in my gleaning knowledge from you both.

have a good day.
<<<--- Eff --->>>
Curious Mind would like to know..

effgjamis

QuoteOriginally posted by blackwings
for ptokax lua api, check =
http://ptxwiki.psycho-chihuahua.net/doku.php

and also check this file in ptokax main folder =
Scripting-Interface.txt

W O W !!!!

A reply before I could complete my post to Madman and you.....

Thanks..

To the books I go... :)
<<<--- Eff --->>>
Curious Mind would like to know..

Madman

QuoteOriginally posted by effgjamis
Madman....... BlackWing

I wish to thank you for your skills in working with the MsgBoard script. Between you and BlackWing, you both are performing way beyond the call.. I thank you for that.

Yep,, you are right,, I do have a question.

As of this writing, I have yet to see any results from my exercising the commands to write/read , etc. but I get no syntax errors and Ptokax does load. ( one issue I see, is that I do not get a name for the script in the User Nick list of the client unless I substitute in FrmHub:Regbot  (Bot)  as FrmHub:Regbot ("PostBox"). and even then via PM or Main Chat, I get no response, nor any thing posted in the file, (messageBoard.txt).
All you need to do is to change...
Bot = "MsgBoard" to Bot = "PostBox"
and...
is your txt called MessageBoard.txt ? it's important with the small and big letters...

QuoteOriginally posted by effgjamis
However, states "kunal" it is working. Soooo, I guess my
question is:

Do I need some supporting drivers, *dll, etc, runtime moduals or ??, which are preventing the script to function for me??
No...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

effgjamis

Thank you for your assistance.. I shall give it a try. (again. LOL   )
<<<--- Eff --->>>
Curious Mind would like to know..

effgjamis

QuoteOriginally posted by madman

All you need to do is to change...
Bot = "MsgBoard" to Bot = "PostBox"
and...
is your txt called MessageBoard.txt ? it's important with the small and big letters...

I am very sorry, but apparently, I don't know what I am doing, or missing something, not formating the commands correctly, or ? or ? or ?

AS the SCRIPT does NOT work for me.

At least the script I have for NMDC works.

thanks for all your consideration and assistance, going back to the drawing board and make some final decisions about LUA vs VB ...
<<<--- Eff --->>>
Curious Mind would like to know..

Madman

Copy the script again... and see if it works for you directly.... before you start to config as you like...
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

effgjamis

QuoteOriginally posted by madman
Copy the script again... and see if it works for you directly.... before you start to config as you like...

Thank you MadMan..

3 times did I copy from the forum the script and the last time I was here, that is prior to now.  

I ran it as if out of the box.(Main and PM). same problems, no syntax error, and commands donot seem to work, and nothing is posted, and the script does not indicate that a posting was or not made. No command error ( syntactical or otherwise ).

I had one other script running, Terminator 5, however, not only did I disable it, I removed it from the script area and made sure no instances were available to Ptokax.
I then loaded the message board script .. and still Nothing.

What else can one DO?  this is getting quite annoying and ridiculus.

This issue has me scratching up the walls, barking at the wife, and locking up the cat and dog in the garage.. However, I do not have a Cat nor Dog...

I would say 99.5% of the time I do not give up on an issue.. but this issue may just be that other .5% .....

Thanks again for your support
<<<--- Eff --->>>
Curious Mind would like to know..

kunal

this one works for me
--Message Board 1.03	10/20/04 LUA 5
--converted to LUA 5 - 09/15/05
--by Mutor
--
-- Provides common message board. Allow users to read/write the board by profiles
-- Option to delete messages, permission bt profile
-- Caches board messages to exteernal text file for script/hub restarts
--
--	+Changes from v 1.00
--		+Added  case sensitive commands, request by NeoUltimicia
--		+Added  date/time to message, request by NeoUltimicia
--		+Errors now sent to PM as well as main
--		+Corrected save string and tweaked table read
--	+Changes from v 1.01
--		+converted to LUA 5 - by blackwings
--		+these prefixes can be used = !+?$# - by blackwings
--	+Changes from v 1.02
--		+fixed a load file bug - by blackwings
--	+Changes from v 1.03
--		+fixed file handling bug
--		+fixed left over lua4 parts
--		-removed VaildCmd stuff
--		+changed MsgBoard function to ToArrival
--		+fixed Prefix error
--		+added auto detect if bot has hubbotname
--		+fixed some minor bugs
--		+added support for mainchat
--		^ Moded by Madman ^
--	?To Do
--		?Allow users to delete their own messages
--		?Add context menu
--
--User Settings-------------------------------------------------------------------------------------
Comm1 = string.lower("read")			-- Script Command, read board
Comm2 = string.lower("write")			-- Script Command, write to board
Comm3 = string.lower("del")			-- Script Command, delete messages
MaxMessages = 50		-- Max number of messages to cache
MsgBoardFile = "MessageBoard.txt"	-- Message file, creat this file in your scripts dir.
rprofiles = {[0]=1,[1]=1,[2]=1,[3]=1,[-1]=1}  	-- Which profiles may read the board?
wprofiles = {[0]=1,[1]=1,[2]=1,[3]=1,[-1]=1}  	-- Which profiles may write to the board?
dprofiles = {[0]=1,[1]=1,[2]=1} 	-- Which profiles may delete messages?
Hub = frmHub:GetHubName()	-- Hub name, pulled from the Px
Bot = frmHub:GetHubBotName()	-- Botname, use frmHub:GetHubBotName() or "BotName"
--End User Settings----------------------------------------------------------------------------------
BoardMessages = {}

function Main()
	LoadFromFile(MsgBoardFile)
	if not (Bot == frmHub:GetHubBotName()) then
		frmHub:RegBot(Bot)
	end
end

function ToArrival(user,data)
	local s,e,whoTo = string.find(data, "%$To:%s(%S+)")
	if whoTo == Bot then
		return MsgBoard(user, data)
	end
end

function ChatArrival(user, data)
	return MsgBoard(user, data)
end

function MsgBoard(user, data)
	local data = string.sub(data,1, -2)
	local s,e,cmd = string.find(data, "%b<>%s+[%!%+%?%$%#](%S+)")
	if cmd then
		s,e,Prefix = string.find(data, "%b<>%s+(%p)%S+")
		local tCmds = {
			[Comm1] = function(user, data)
				if rprofiles[user.iProfile]==1 then
					ReadBoard(user) return 1
				end
			end,
			[Comm2] = function(user, data)
				if wprofiles[user.iProfile]==1 then
					local s,e,msg = string.find(data, "%b<>%s+%S+%s(.*)")
					if msg == nil then
						local dsp
						dsp = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
						dsp = dsp.."\t"..Hub.."\tMessage Board\r\n"
						dsp = dsp.."\tDid you forget what you were going to say?\r\n"
						dsp = dsp.."\tCommand syntax is ->> "..Prefix..Comm2.." \r\n"
						dsp = dsp.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
						user:SendData(Bot,dsp)
						SendPmToNick(user.sName,Bot,dsp)
						return 1
					else
						Write2Board(user, msg)
						return 1
					end
				end
			end,
			[Comm3] = function(user, data)
				if dprofiles[user.iProfile]==1 then
					local s,e,delmsg = string.find(data, "%b<>%s+%S+%s+(%d+)")
					if (delmsg == nil) then
						local dsp0
						dsp0 = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
						dsp0 = dsp0.."\t"..Hub.."\tMessage Board\r\n"
						dsp0 = dsp0.."\tDelete which message? Provide message number\r\n"
						dsp0 = dsp0.."\tCommand syntax is ->> "..Prefix..Comm3.." \r\n"
						dsp0 = dsp0.."\tType ->> "..Prefix..Comm1.."  to list messages \r\n"
						dsp0 = dsp0.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
						user:SendData(Bot,dsp0)
						SendPmToNick(user.sName,Bot,dsp0)
						return 1
					else
						--if BoardMessages[delmsg] ~= 1 then user:SendData(Bot,dsp0) return 1 end
						table.remove(BoardMessages, delmsg)
						SaveToFile(MsgBoardFile , BoardMessages , "BoardMessages")
						user:SendData(Bot,"Message number [ "..delmsg.." ] has been deleted.")
						SendPmToNick(user.sName,Bot,"Message number [ "..delmsg.." ] has been deleted.")
						return 1
					end
				end
			end,
		}
		if tCmds[cmd] then
			return tCmds[cmd](user, data)
		end
	end
end

function ReadBoard(user)
	local n = table.getn(BoardMessages)
	local dsp1
	dsp1 = "\r\n=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
	dsp1 = dsp1.."  "..Hub.."\tMessage Board\t Displayng last [ "..n.." ] message(s)\r\n"
	dsp1 = dsp1.."=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n\r\n"
		for i = 1, n do
			BoardMessages[i] = string.gsub(BoardMessages[i],"\n","\r\n\t")
			BoardMessages[i] = string.gsub(BoardMessages[i],"wrote::","wrote::\r\n\t")
			dsp1 = dsp1.."\r\n[ "..i.." ]\t"..BoardMessages[i].."\r\n\r\n"
		end
		SendPmToNick(user.sName, Bot, dsp1)
end

function Write2Board(user, msg)
	local dsp2
	dsp2 = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
	dsp2 = dsp2.."\t[ "..user.sName.." ] just posted to the "..Hub.." Message Board\r\n"
	dsp2 = dsp2.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
	dsp2 = dsp2.."\tType "..Prefix..Comm1.." in main/pm to list or "..Prefix..Comm2.."  to post .\r\n"
	dsp2 = dsp2.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n\r\n"
	SendToAll(Bot, dsp2)
	table.insert(BoardMessages, ("On "..os.date("%B %d %Y %X ").." [ "..user.sName.." ] wrote::")..msg)
		if table.getn(BoardMessages) > MaxMessages then table.remove(BoardMessages, 1) end
		SaveToFile(MsgBoardFile , BoardMessages , "BoardMessages")
	end

function Serialize(tTable, sTableName, sTab)
	assert(tTable, "tTable equals nil");
	assert(sTableName, "sTableName equals nil");
	assert(type(tTable) == "table", "tTable must be a table!");
	assert(type(sTableName) == "string", "sTableName must be a string!");
	sTab = sTab or "";
	sTmp = ""
	sTmp = sTmp..sTab..sTableName.." = {\n"
	for key, value in tTable do
		local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
			sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
		end
		sTmp = sTmp..",\n"
	end
	sTmp = sTmp..sTab.."}"
	return sTmp
end

function SaveToFile(file , table , tablename)
	local handle = io.open(file,"w+")
	handle:write(Serialize(table, tablename))
	handle:flush()
	handle:close()
end

function LoadFromFile(file)
	local handle = io.open(file,"r")
	if (handle ~= nil) then
		dofile(file)
		handle:flush()
		handle:close()
	end
end


and dont forget to create a file MessageBoard.txt in scripts folder.

effgjamis

Kunal....
Quotethis one works for me


code:----------------------------------------------------------------------------------Message Board 1.03   10/20/04 LUA 5
--converted to LUA 5 - 09/15/05


Thank you Kunal,, I will try this one,, as I see some differences..

Will let you know. :)
<<<--- Eff --->>>
Curious Mind would like to know..

effgjamis

QuoteOriginally posted by kunal
this one works for me
--Message Board 1.03	10/20/04 LUA 5
--converted to LUA 5 - 09/15/05
--by Mutor
--
-- Provides common message board. Allow users to read/write the board by profiles
[/quote]

Hey Kunal...

As you said " it works " yep.. thank you .. 

When I ran it out of box ( before any modifications ) I see that the bot name did not appear in the Nick user list ( at least for me ).  I then made the following change to your script
[code]
from:
Bot = frmHub:GetHubBotName()	-- Botname, use frmHub:GetHubBotName() or "BotName"

to:
Bot = ("NewsBoard") -- frmHub:GetHubBotName()	-- Botname, use frmHub:GetHubBotName() or "BotName"

By making this change, the script is now shown in the Nick User list as " NewsBoard"

I have not completely tested the script, for my use, but I am in the process of doing so. I will keep you advised as to any issues that appear..

Thank you so much, as I have not a clue ( yet ) why the other scripts would not function.. Weird...

Ah,, I did find a issue prior to writing this post.
It deals with a compatable issue, (apparently command Prefix's I think).

Not sure about RoboCop  or others, but Terminator 5 for sure.  If you load Terminator as the last script to run in the scipt section of Ptokax V3.3.21, you will not have an issue. However if you load it first, then the other scripts including the message board, the Message board  script does not work.. This is not the case in my test's of the other scripts, as I had completely removed Terminator.

NOW, perhaps this ole man can get down to business of getting the Ptokax hub configured so it may replace, ( Oh YEAH) NMDC hub software..

Thanks goes to you, for giving me your copy, and MY thanks to all the others who contributed their talent to make this happen..

If gratitude was fat, I would have to buy new clothes or go naked.. Naked... NAH, the wife would....Censor'd ...

Upon my test completion, I will advise all, so that this thread can be closed... as a successfull resolution..

all have a good one,
<<<--- Eff --->>>
Curious Mind would like to know..

effgjamis

Hello All...

Satus of Message Board..
 I have had no problems in writing, reading or deleting the messages... WOW .. whooopie..

However.... :((

There seems to be an alot of extra white space in the message.  When I key, in main chat or PM, +read  
I have approx 6-10 lines between the written by and the actual text.  So if you have 1-2-3 or more posters, you have a gillion lines of white space...well maybe not a gillion, but bucket full, for sure.

Is it possible for any of you to take a peek and see if those extra blank lines (white spaces) be removed.

I thank you in advance..

OH.. the code is what Kunal posted .. It works... :))
<<<--- Eff --->>>
Curious Mind would like to know..

Madman

found and fixed..
and the only diffrence from mine and kunal...
is the fix i just made..
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

effgjamis

Thank you MadMan

I will test the white space fix shortly.

Really appreciate your efforts...

have a good one and I will get back here as soon as I can..
<<<--- Eff --->>>
Curious Mind would like to know..

effgjamis

#43
Hello ALL

Thank you so much in all of your time, consideration, talent, patience and timely responce to resolution of the problem/problems, modifications etc, to the Message Board Script..

I have tested it, in my feeble way, and I find that it works very well, except it must be loaded prior to Terminator/robocop/xthetic-server else it will not function.

My upmost appreciation goes to Blackwing, Madman, Kunal and last but not least, Mutor the orginal author.

IT WORKS........ Great JOB

Again.. Thanks ......... ( I guess this thread is finished..Whewww! )

I have modified the working script into two separate Scripts, which I call NewsPaper and the other OP_Journal. of which all users can read/write to the NewsPaper and only the OP's can use the OP_Journal.. If anyone would like a copy of them please contact me, here or email..

I thank all .. who have given me assistance.. learned alot from this experience, but still have mountains to climb.
<<<--- Eff --->>>
Curious Mind would like to know..

Skippy84

i added a rightclick men? for the script the german version is aviable at follow link

German Version of MessageBoard 1.04


--Message Board 1.03	10/20/04 LUA 5
--converted to LUA 5 - 09/15/05
--by Mutor
--
-- Provides common message board. Allow users to read/write the board by profiles
-- Option to delete messages, permission bt profile
-- Caches board messages to exteernal text file for script/hub restarts
--

--	+Changes from v 1.00
--		+Added  case sensitive commands, request by NeoUltimicia
--		+Added  date/time to message, request by NeoUltimicia
--		+Errors now sent to PM as well as main
--		+Corrected save string and tweaked table read

--	+Changes from v 1.01
--		+converted to LUA 5 - by blackwings
--		+these prefixes can be used = !+?$# - by blackwings

--	+Changes from v 1.02
--		+fixed a load file bug - by blackwings

--	+Changes from v 1.03
--		+fixed file handling bug
--		+fixed left over lua4 parts
--		-removed VaildCmd stuff
--		+changed MsgBoard function to ToArrival
--		+fixed Prefix error
--		+added auto detect if bot has hubbotname
--		+fixed some minor bugs
--		+added support for mainchat
--		+fixed extra linespacing
--		^ Moded by Madman ^

--	+Changes from v 1.04
--		+added right click menu it displayed only for user allowed commands
--    touched by skippy84


--	?To Do
--		?Allow users to delete their own messages
--

--User Settings-------------------------------------------------------------------------------------

Comm1 = string.lower("read")			-- Script Command, read board
Comm2 = string.lower("write")			-- Script Command, write to board
Comm3 = string.lower("del")			-- Script Command, delete messages

MaxMessages = 50		-- Max number of messages to cache
MsgBoardFile = "MessageBoard.txt"	-- Message file, creat this file in your scripts dir.

rprofiles = {[0]=1,[1]=1,[2]=1,[3]=1,[-1]=1}  	-- Which profiles may read the board?
wprofiles = {[0]=1,[1]=1,[2]=1,[3]=1,[-1]=1}  	-- Which profiles may write to the board?
dprofiles = {[0]=1,[1]=1,[2]=1} 	-- Which profiles may delete messages?

Hub = frmHub:GetHubName()	-- Hub name, pulled from the Px
Bot = frmHub:GetHubBotName()	-- Botname, use frmHub:GetHubBotName() or "BotName"

--End User Settings----------------------------------------------------------------------------------

BoardMessages = {}



function Main()
	LoadFromFile(MsgBoardFile)
	if not (Bot == frmHub:GetHubBotName()) then
		frmHub:RegBot(Bot)
	end
end

-------------------------------------------------------------------------------------
--context men?
-------------------------------------------------------------------------------------

function NewUserConnected(user)
	if user.bUserCommand then
		if rprofiles[user.iProfile]==1 then
		  user:SendData("$UserCommand 1 3 :MessageBoard:\\read board$<%[mynick]> !"..Comm1.."||")
		end
		if wprofiles[user.iProfile]==1 then
		  user:SendData("$UserCommand 1 3 :MessageBoard:\\write to board$<%[mynick]> !"..Comm2.." %[line:Enter the Message:]||")
		end
		if dprofiles[user.iProfile]==1 then
			user:SendData("$UserCommand 1 3 :MessageBoard:\\delete messages$<%[mynick]> !"..Comm3.." %[line:Enter Nr of post to Delete:]||")
		end
	end
end

OpConnected=NewUserConnected

-------------------------------------------------------------------------------------
--context men? end
-------------------------------------------------------------------------------------


function ToArrival(user,data)
	local s,e,whoTo = string.find(data, "%$To:%s(%S+)")
	if whoTo == Bot then
		return MsgBoard(user, data)
	end
end



function ChatArrival(user, data)
	return MsgBoard(user, data)
end



function MsgBoard(user, data)
	local data = string.sub(data,1, -2)
	local s,e,cmd = string.find(data, "%b<>%s+[%!%+%?%$%#](%S+)")
	if cmd then
		s,e,Prefix = string.find(data, "%b<>%s+(%p)%S+")
		local tCmds = {
			[Comm1] = function(user, data)
				if rprofiles[user.iProfile]==1 then
					ReadBoard(user) return 1
				end
			end,
			[Comm2] = function(user, data)
				if wprofiles[user.iProfile]==1 then
					local s,e,msg = string.find(data, "%b<>%s+%S+%s(.*)")
					if msg == nil then
						local dsp
						dsp = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
						dsp = dsp.."\t"..Hub.."\tMessage Board\r\n"
						dsp = dsp.."\tDid you forget what you were going to say?\r\n"
						dsp = dsp.."\tCommand syntax is ->> "..Prefix..Comm2.." \r\n"
						dsp = dsp.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
						user:SendData(Bot,dsp)
						SendPmToNick(user.sName,Bot,dsp)
						return 1
					else
						Write2Board(user, msg)
						return 1
					end
				end
			end,
			[Comm3] = function(user, data)
				if dprofiles[user.iProfile]==1 then
					local s,e,delmsg = string.find(data, "%b<>%s+%S+%s+(%d+)")
					if (delmsg == nil) then
						local dsp0
						dsp0 = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
						dsp0 = dsp0.."\t"..Hub.."\tMessage Board\r\n"
						dsp0 = dsp0.."\tDelete which message? Provide message number\r\n"
						dsp0 = dsp0.."\tCommand syntax is ->> "..Prefix..Comm3.." \r\n"
						dsp0 = dsp0.."\tType ->> "..Prefix..Comm1.."  to list messages \r\n"
						dsp0 = dsp0.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
						user:SendData(Bot,dsp0)
						SendPmToNick(user.sName,Bot,dsp0)
						return 1
					else
						--if BoardMessages[delmsg] ~= 1 then user:SendData(Bot,dsp0) return 1 end
						table.remove(BoardMessages, delmsg)
						SaveToFile(MsgBoardFile , BoardMessages , "BoardMessages")
						user:SendData(Bot,"Message number [ "..delmsg.." ] has been deleted.")
						SendPmToNick(user.sName,Bot,"Message number [ "..delmsg.." ] has been deleted.")
						return 1
					end
				end
			end,
		}
		if tCmds[cmd] then
			return tCmds[cmd](user, data)
		end
	end
end



function ReadBoard(user)
	local n = table.getn(BoardMessages)
	local dsp1
	dsp1 = "\r\n=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
	dsp1 = dsp1.."  "..Hub.."\tMessage Board\t Displayng last [ "..n.." ] message(s)\r\n"
	dsp1 = dsp1.."=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n\r\n"
		for i = 1, n do
			dsp1 = dsp1.."\r\n[ "..i.." ]\t"..BoardMessages[i].."\r\n\r\n"
		end
		SendPmToNick(user.sName, Bot, dsp1)
end



function Write2Board(user, msg)
	local dsp2
	dsp2 = "\r\n\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
	dsp2 = dsp2.."\t[ "..user.sName.." ] just posted to the "..Hub.." Message Board\r\n"
	dsp2 = dsp2.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n"
	dsp2 = dsp2.."\tType "..Prefix..Comm1.." in main/pm to list or "..Prefix..Comm2.."  to post .\r\n"
	dsp2 = dsp2.."\t=-=<>=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=<>=-=\r\n\r\n"
	SendToAll(Bot, dsp2)
	table.insert(BoardMessages, ("On "..os.date("%B %d %Y %X ").." [ "..user.sName.." ] wrote: ")..msg)
		if table.getn(BoardMessages) > MaxMessages then table.remove(BoardMessages, 1) end
		SaveToFile(MsgBoardFile , BoardMessages , "BoardMessages")
	end



function Serialize(tTable, sTableName, sTab)
	assert(tTable, "tTable equals nil");
	assert(sTableName, "sTableName equals nil");
	assert(type(tTable) == "table", "tTable must be a table!");
	assert(type(sTableName) == "string", "sTableName must be a string!");
	sTab = sTab or "";
	sTmp = ""
	sTmp = sTmp..sTab..sTableName.." = {\n"
	for key, value in tTable do
		local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
			sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
		end
		sTmp = sTmp..",\n"
	end
	sTmp = sTmp..sTab.."}"
	return sTmp
end



function SaveToFile(file , table , tablename)
	local handle = io.open(file,"w+")
	handle:write(Serialize(table, tablename))
	handle:flush()
	handle:close()
end



function LoadFromFile(file)
	local handle = io.open(file,"r")
	if (handle ~= nil) then
		dofile(file)
		handle:flush()
		handle:close()
	end
end

SMF spam blocked by CleanTalk