Letting ops ammend their own welcomes
 

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

Letting ops ammend their own welcomes

Started by Stravides, 16 January, 2004, 02:59:24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Stravides

Ok I have as the majority of site a welcome and exit message for my ops n vips.

what I want is a facility to say !changelogin and it will read from the messages file and update that users message
the current message file is in the format

stravides1       = "The Heavens hathed opened and thus vomitted forth the hapless figure of Stravides"
stravides2      = "And thus it had to come to an end, dont cry, for Stravides will return"
malevolence1       = "Bow down and Cower for Malevolence has arrived.."
malevolence2      = "Where's that mangy chufter Malevolence off to, no doubt he will return soon"

where username1 is a login username2 is a logout

I have also toyed with the idea of tables ie

-- OPLIST Variables
op1="Stravides"
op2="Malevolence"
op3="Reload3d"

LogoutTable = {
[1] = " logging Out",
[2] = " logging Out",
[3] = " logging Out"
};

LoginTable = {
[1] = " logging In",
[2] = " logging In",
[3] = " logging In"
};

any help would be appreciated as I keep on going in cirles here... code pointers full blown commented code would be ok too I suppose....  seriously Many thanks for your ideas in advance

Stravides
RPGBooks-Cymru.no-ip.org:411

Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

plop

do i get it right that you know some or wanne learn lua???
if so i got that function in a.i., if you want i can give you the functions so you can put it 2gether yourself.
or grab tezlo's welcome bot and i'll help you add a cmd 2 that 2 let the op's change there welcome.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

QuoteOriginally posted by plop
do i get it right that you know some or wanne learn lua???
if so i got that function in a.i., if you want i can give you the functions so you can put it 2gether yourself.
or grab tezlo's welcome bot and i'll help you add a cmd 2 that 2 let the op's change there welcome.

plop

GRRRR, has my new G6 got anything your's hasnt hmmm, grr damn i thought it was an original idea lol, well like they say, great minds think alike LOL he he he
Resistance is futile!

Stravides

QuoteOriginally posted by plop
do i get it right that you know some or wanne learn lua???
if so i got that function in a.i., if you want i can give you the functions so you can put it 2gether yourself.
or grab tezlo's welcome bot and i'll help you add a cmd 2 that 2 let the op's change there welcome.

plop

Cheers for speedy reply, i can bodge not too badly, ie i can understand the majority of what you chaps write, i just cant do it myself yet..

I do not understand the
if strsub(data, 1, 1) == "<" then
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind(data,"%b<>%s+(%S+)")  bits

I have my bot taking the welcomes from a file and really would prefer that to be separate from the bot as I dont want users tinkerin with the bot :)

any help greatly appreciated

I have included smeagol here

-- Many thanks to Troubadour & [NL]-=DJ_Bert=- for the majoity of the code in here from
-- Guardian..  Just didnt do what I needed really...  So hence the mods


BOTName="Smeagol"
HubAdress = "RPGBooks-Cymru.no-ip.org"
ScriptVersion = "Stripped Version V6.99" 
BOTNameInfo = "$MyINFO $ALL "..BOTName.." <++V:1.3 Stravides $ $Black Light"..strchar( 1 ).."$Stravides@RPGBooks-Cymru.no-ip.org$" 


rules = "\r\n"..
"                                   Rules \r\n"..
"\r\n"..
"Failure to comply with these rules will mean perm bans from this hub.\r\n"..
"\r\n"..
"01. You must share at least 50MB of Applicable Files. (RPG, Video, MP3)\r\n"..
"02. Please speak English *only* in the main chat. We realize that not everyone is fluent in it, be hey, look at it as a learning experience !\r\n"..
"03. Zero Porn Toleration. This means your run-of-the-mill stuff Hentai, Disney toons, or anything similar. You will receive one warning. Then you will be banned. Sick porn, teen porn, and/or kiddie porn will all be banned without warning or absolution. \r\n"..
"04. Don't use excessive Caps in main chat, don't change your nick, do not flood or spam, and do not post ads for other hubs.\r\n"..
"05. Slotlocking or faksesharing will result in an immediate and permanent ban. No questions asked.\r\n"..
"06. Download speed limiters (shown as B: or L: in desc tags) are not allowed in this hub it will lead to a ban. \r\n"..
"07. 3 kicks will lead to automatic ban!\r\n"..
"08. No racist propaganda or music.\r\n"..
"09. Don't share installed Games/Programs files or incomplete files \r\n"..
"10. Don't share .VOB-files \r\n"..
"11. Don't share *.eml or *.pst-files (your e-mail files). Besides being stupid to share your private e-mail, they may contain viruses.\r\n"..
"12. Don't close other users from downloading. (If you must do it, then give them a good reason!)\r\n"..
"13. Don't flood or spam the chat.\r\n"..
"14. Don't attack other hub users in the main chat. Chat nice or don't chat at all!\r\n"..
"15. Don't ask for OP. we'll ask you :)\r\n"


ptokaxcommands = {
	op = 1, drop = 1, ban = 1, unban = 1, nickban = 1, getbanlist = 1,
	getinfo = 1, gag = 1, ungag = 1, banip = 1, ipinfo = 1, iprangeinfo = 1,
	userinfo = 1, clrtempban = 1, stat = 1 }

ptokax2commands = {
	clrpermban = 1, topic = 1, reloadtxt = 1 }

dofile("messages.cfg");  -- used for in n out strings

version = BOTName.." "..ScriptVersion 
prefix = "?"

function Main() 
	frmHub:UnregBot(BOTName) 
	frmHub:RegBot(BOTName) 
	SendToAll(BOTNameInfo)
	AddProfile("Moderator", 4269273088)
	AddProfile("Guest", 2148028000)
end 

function DoRead(user)
	while 1 do 
		pline = read() 
		if pline == nil then break end
			user:SendPM(BOTName, pline)
		end 
	readfrom() 
end

function MyInfoString(data)
	s,e,description,speed,email,share = strfind(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
	speed = strsub(speed,1,strlen(speed)-1) 
	return description,speed,email,share
end

--------- Op Connected ---------
function OpConnected(user)
	description,speed,email,share=MyInfoString(user.sMyInfoString)
	local share2 = share / (1024*1024*1024)
	if (user.sName == "Stravides") then SendToAll(BOTName,""..stravides1.."")	
		elseif (user.sName == "Malevolence") then SendToAll(BOTName, ""..malevolence1.."") 
		elseif (user.sName == "Blumpy") then SendToAll(BOTName, ""..blumpy1.."") 
		elseif (user.sName == "Feuer_Frei") then SendToAll(BOTName, ""..feuer_frei1.."") 
		elseif (user.sName == "Tumnakitty") then SendToAll("Bast", ""..tumnakitty1.."") 
		elseif (user.sName == "Findor_Tallwillow") then SendToAll(BOTName, ""..findor_tallwillow1.."") 
		elseif (user.sName == "Sniffy") then SendToAll(BOTName, ""..sniffy1.."") 
		elseif (user.sName == "Reload3d") then SendToAll(BOTName, ""..reload3d1.."") 
	else    SendToAll(BOTName, "[OPS] "..user.sName.." has joined the hub") 
	end
end

			
-- Op Disconnected 
function OpDisconnected(user)
	description,speed,email,share=MyInfoString(user.sMyInfoString)
	local share2 = share / (1024*1024*1024)

	if (user.sName == "Stravides") then SendToAll(BOTName,""..stravides2.."")	
		elseif (user.sName == "Malevolence") then SendToAll(BOTName, ""..malevolence2.."") 
		elseif (user.sName == "Blumpy") then SendToAll(BOTName, ""..blumpy2.."") 
		elseif (user.sName == "Feuer_Frei") then SendToAll(BOTName, ""..feuer_frei2.."") 
		elseif (user.sName == "Tumnakitty") then SendToAll("Bast", ""..tumnakitty2.."") 
		elseif (user.sName == "Findor_Tallwillow") then SendToAll(BOTName, ""..findor_tallwillow2.."") 
		elseif (user.sName == "Sniffy") then SendToAll(BOTName, ""..sniffy2.."") 
		elseif (user.sName == "Reload3d") then SendToAll(BOTName, ""..reload3d2.."") 
		elseif user.iProfile == 1 then SendToAll(BOTName, "[OP] "..user.sName.." Has Left the Hub")  
	end
end

-- Vip Connected
function NewUserConnected(user)
	if (user.sName == "Morgyn") then SendToAll(BOTName,""..morgyn1.."")	
		elseif (user.sName == "Kyoya") then SendToAll(BOTName, ""..kyoya1.."") 
		elseif (user.sName == "Warian") then SendToAll(BOTName, ""..warian1.."") 
		elseif (user.sName == "Spider") then SendToAll(BOTName, ""..spider1.."") 
		elseif (user.sName == "fortywinks") then SendToAll(BOTName, ""..fortywinks1.."") 
		elseif user.iProfile == 2 then SendToAll(BOTName, "[VIP] "..user.sName..", "..line.." ")  
		elseif user.iProfile == nil then SendToNick(BOTName, ""..user.sName.." has Connected" )
	end
end

-- Vip Disconnected
function UserDisconnected(user)

	if (user.sName == "Morgyn") then SendToAll(BOTName,""..morgyn2.."")	
		elseif (user.sName == "Kyoya") then SendToAll(BOTName, ""..kyoya2.."") 
		elseif (user.sName == "Warian") then SendToAll(BOTName, ""..warian2.."") 
		elseif (user.sName == "Spider") then SendToAll(BOTName, ""..spider2.."") 
		elseif (user.sName == "fortywinks") then SendToAll(BOTName, ""..fortywinks2.."") 
		elseif user.iProfile == 2 then SendToAll(BOTName, "[VIP] "..user.sName..", "..line2.." ")  
	end
end

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")

		if cmd == prefix.."changelogin" then
			user:SendPM(BOTName,"Your Login Message has been changed")
			return 1	
		
		elseif cmd == prefix.."changelogout" then
			user:SendPM(BOTName,"Your Logout Message has been changed")
			return 1
		elseif cmd == "!rules" then
			user:SendPM(BOTName,rules)
			return 1
		
		elseif (cmd == "!myip" ) then
			user:SendData(BOTName,"Your preciousssss IP issssss: "..user.sIP)
			return 1
		elseif (cmd == "!mmop" ) then
			_,_,cmd,message = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
			if user.iProfile == 1 or user.iProfile == 0 or user.iProfile == 4 then 
			SendPmToOps(user.sName, message)
			return 1
		end end
	end
end
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

plop

QuoteOriginally posted by (uk-kingdom)pH?tt?
QuoteOriginally posted by plop
do i get it right that you know some or wanne learn lua???
if so i got that function in a.i., if you want i can give you the functions so you can put it 2gether yourself.
or grab tezlo's welcome bot and i'll help you add a cmd 2 that 2 let the op's change there welcome.

plop

GRRRR, has my new G6 got anything your's hasnt hmmm, grr damn i thought it was an original idea lol, well like they say, great minds think alike LOL he he he
-- v0.9fP.a editkick/editleave/editwelcome - every op can edit his own kick/welcome/leave text if special anounce/kick is enabled
lol you could have known. lol
you have a.i. it's in the changelog, added it a long time back.
gues were both pretty crazy. lol

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

ye lol u guess, oh well might as well let u know that G6 has a user account for each op, they have all their own setup's so they can setup how they kick, setup there own commands etc ;)
Resistance is futile!

plop

#6
QuoteOriginally posted by Stravides
QuoteOriginally posted by plop
do i get it right that you know some or wanne learn lua???
if so i got that function in a.i., if you want i can give you the functions so you can put it 2gether yourself.
or grab tezlo's welcome bot and i'll help you add a cmd 2 that 2 let the op's change there welcome.

plop

Cheers for speedy reply, i can bodge not too badly, ie i can understand the majority of what you chaps write, i just cant do it myself yet..

I do not understand the
if strsub(data, 1, 1) == "<" then
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind(data,"%b<>%s+(%S+)")  bits

I have my bot taking the welcomes from a file and really would prefer that to be separate from the bot as I dont want users tinkerin with the bot :)

any help greatly appreciated

I have included smeagol here
well you have a nice start and as you wanne learn, lets take it step by step.
so in the end you whill have made it yourself.

1st some stuff about what you didn't understand as your gone need it.

if strsub(data, 1, 1) == "<" then    <--- this line checks if data is send in mainchat, this always starts with a <

data=strsub(data,1,strlen(data)-1)    <---- this line strips the last character from the send line of data, this is always a |

for more info about this i suggest you read this


s,e,cmd = strfind(data,"%b<>%s+(%S+)")
this 1 is a bit more diffecult, looks like some funny stuff but it's the most used thing.
the s and e are mostly just dummy's, forget about them for now.
strfind is in full string find (yes i'm skipping something).
cmd is what we wanne find.
data is where we wanne search for it.
and finaly the "%b<>%s+(%S+)" is the pattern were searching for and between the ( ) marks is what we wanne find and hook 2 cmd.
more about these patterns can be found here


now your 1st task after reading that tiny bit.
add the command !changelogin 2 dataarrival and if a user triggers that you need 2 do a little extended search for what he typed behind the command.
all were gone do with that is have the bot say that in mainchat.

thats all for now, good luck.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

plop

QuoteOriginally posted by (uk-kingdom)pH?tt?
ye lol u guess, oh well might as well let u know that G6 has a user account for each op, they have all their own setup's so they can setup how they kick, setup there own commands etc ;)
cool, but i rather not add those things, it can easely make it 2 heavy.
just as i never whill add language files.
but who knows, never say never. lol

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

QuoteOriginally posted by plop
QuoteOriginally posted by (uk-kingdom)pH?tt?
ye lol u guess, oh well might as well let u know that G6 has a user account for each op, they have all their own setup's so they can setup how they kick, setup there own commands etc ;)
cool, but i rather not add those things, it can easely make it 2 heavy.
just as i never whill add language files.
but who knows, never say never. lol

plop

as long as everything is based in memory who cars, 5k memory not a killer lol ;), a little extra bandwidth, but, its actually oretty lite and smooth, but it wont be released until i return ;)
Resistance is futile!

plop

QuoteOriginally posted by (uk-kingdom)pH?tt?
QuoteOriginally posted by plop
QuoteOriginally posted by (uk-kingdom)pH?tt?
ye lol u guess, oh well might as well let u know that G6 has a user account for each op, they have all their own setup's so they can setup how they kick, setup there own commands etc ;)
cool, but i rather not add those things, it can easely make it 2 heavy.
just as i never whill add language files.
but who knows, never say never. lol

plop

as long as everything is based in memory who cars, 5k memory not a killer lol ;), a little extra bandwidth, but, its actually oretty lite and smooth, but it wont be released until i return ;)
memory isn't the problem indeed, bandwidth is more.
1 of our hub's is always on the limits of it's bandwidth.
we need 1 extra hub 2 take over some of it's users (any1 feeling interested feel free 2 contact me, but we rather not have any1 just starting, this as we have had several newbie's stopping after a couple weeks, we have a high standard for joining the network).
but hey hurry back you made me curious. lol

btw it's a real O.T. day for us 2 i believe.
but for me it's a bit over, need 2 dive in bed.
cya hopefully soon, otherwise later.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Stravides

Quotenow your 1st task after reading that tiny bit.
add the command !changelogin 2 dataarrival and if a user triggers that you need 2 do a little extended search for what he typed behind the command.
all were gone do with that is have the bot say that in mainchat.

thats all for now, good luck.

plop

Ok the links didnt work for me, but i dug about in some of the code that I already have for other bits n bobs and came up with

function DataArrival(user,data)
   if strsub(data, 1, 1) == "<" then
      data=strsub(data,1,strlen(data)-1)
      s,e,cmd = strfind(data,"%b<>%s+(%S+)")

      if cmd == prefix.."changelogin" then
         _,_,cmd,message = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
         SendToAll(BOTName, "New Login :> "..message)   

this gives output of

!changelogin Welcomes Stravides to the world of Hades
New Login :> Welcomes Stravides to the world of Hades

please continue ...  :)

regards
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

plop

oke Stravides, good job.
but gone write the next lesson 2morrow as i'm now really falling asleep here.
those links were pointing 2 the howto section of this board.
look for pattern matching and strsub there.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Stravides

QuoteOriginally posted by plop
oke Stravides, good job.
but gone write the next lesson 2morrow as i'm now really falling asleep here.
those links were pointing 2 the howto section of this board.
look for pattern matching and strsub there.

plop

I await with glee :)
gnight
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

plop

ok next lesson. lol
on the site where you can download ptokax you can also find lua command line.
grab that and excute the next scipt with that.
table= {[1]=1, [5]=1, [2]=1, [9]=1, [4]=1, }

for i=1, 10 do
   if table[i] then
      print(i.." is in the table")
   else
      print(i.." isn't in the table")
   end
end
were gone use a table like that 2 store all the welcome msg's.
for now were not yet gone save it, just use memory 2 store them temperarly.

the table whill look like this.
Table = { ["username"]="welcome text here", ["username2"]="welcome text here from user 2"}

so we can grab the welcome text for the matching user by giving the name of the user as key 2 search with.
the "for i-1, 10 do isn't what we are gone need but the rest we are gone need.
Table[user.sName] is how we grab the welcome text.

i hope this is all your gone need so far, if not just ask.
next lesson were gone put this and the previous 2gether 2 change the text.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Stravides

Sorry NEVER used lua command line, i type the script into the window and i get errors

for i=1, 10 do
error: 'end' expected;
  last token read: '' at line 1 in string "for i=1, 10 do "

I have no idea how to use command line where to put it or whether I should link it up or what

it lets the 1st line be typed in, but not the second

soryy for being so dim

awaiting tutorial for the lua command line muppet that I am

regards Strav
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

SaintSinner

QuoteOriginally posted by Stravides
Sorry NEVER used lua command line, i type the script into the window and i get errors



mind if i join in on this, im learning too,
but go to ptacez site here

there you can get the lua commandline and run that
code he gave you but dont copy and paste, it will
give you errors, you need to type it in from scratch.
and then hit enter when done, and the links do work,
you just need to remove the first part of the url, like this
it will come up as
http://board.univ-angers.fr/"http://board.univ-angers.fr/thread.php?threadid=764&boardid=4&styleid=1

remove the first http://board.univ-angers.fr/"
and you will have the actual link for the lessons.
   


Stravides

Thats the lua command line edit or I got,
i typed it in, not copied, an still get the same error..

I'm a muppet...  :rolleyes:  i see, all on one line, no returns :S

thats ok, I now have the output

Lua 4.0  Copyright (C) 1994-2000 TeCGraf, PUC-Rio
>
> table= {[1]=1, [5]=1, [2]=1, [9]=1, [4]=1, }
>
> for i=1, 10 do  if table[i] then print(i.."  is in the table") else print(i.."
 is not in the table") end end
1  is in the table
2  is in the table
3 is not in the table
4  is in the table
5  is in the table
6 is not in the table
7 is not in the table
8 is not in the table
9  is in the table
10 is not in the table
>

so would i then create a table in my external file or would it be in the actual lua ?  or am i leaping ahead of myself ?

:)

regards
Stravides
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

plop

hi hi saint, your very welcome 2 join.

the links are fixed, used some html things by accident.

you can copy/paste the example script in2 notepad and save it as .lua
then you can launch it with the lua command line.
lua

if you start the lua command line without arguments you enter a so called realtime scripting eviroment.
you can type pieces of code there and everytime you press the enter button it execute's the code.

i reguarly use the lua command line for giving examples, as it's very handy 2 test if things actualy work and how they work.
you can emulate everything which can happen in the hub's.

ok go and study you 2 (and everybody not posting but also trying). lol
when i see some scripts here with the table in it i'll continue.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Stravides

Ok so the table is the entrances at the moment, the exits will be same procedure exept diff table passed to function I take it

anyway the table is set up, and there is a func to display the table !displaytable which when runs dispays the entrance message :)  getting this so far I think hehe


-- Many thanks to Troubadour & [NL]-=DJ_Bert=- for the majoity of the code in here from
-- Guardian..  Just didnt do what I needed really...  So hence the mods

--    Variables  
BOTName="Smeagol"
HubAdress = "RPGBooks-Cymru.no-ip.org"
ScriptVersion = "Stripped Version V6.99" 
BOTNameInfo = "$MyINFO $ALL "..BOTName.." <++V:1.3 Stravides $ $Black Light"..strchar( 1 ).."$Stravides@RPGBooks-Cymru.no-ip.org$" 
version = BOTName.." "..ScriptVersion 
prefix = "!"

ptokaxcommands = {
	op = 1, drop = 1, ban = 1, unban = 1, nickban = 1, getbanlist = 1,
	getinfo = 1, gag = 1, ungag = 1, banip = 1, ipinfo = 1, iprangeinfo = 1,
	userinfo = 1, clrtempban = 1, stat = 1 }

ptokax2commands = {
	clrpermban = 1, topic = 1, reloadtxt = 1 }

dofile("messages.cfg");  -- used for in n out strings

UserTable = { ["Stravides"]="The Heavens hathed opened and thus vomitted forth the hapless figure of Stravides",
["Malevolence"]="Bow down and Cower for Malevolence has arrived..",
["Blumpy"]="From the festering brown froth of the sewers, the Overlord of Faeces, Blumpy, emerges.",
["Findor_Tallwillow"]="Beware, fakers, slot-lockers and other lamers... Findor_Tallwillow is here to give you a quick trip to the Abyss... If you aren't one of the above, then smile, and have a good day! :)",
["Sniffy"]="Best be on yer best behaviour as Mrs Sniffy has arrived..",
["Reload3d"]="A large dog looms over, twitches, moans and chuffs up the steaming body of Reload3d - eeeeew",
["Feuer_Frei"]="Misfits & Miscreants beware! Feuer_Frei is here to check your share!!",
["Warian"]="Warian - The one who is all that which stands for that which is the epitome` of that which is The World of [Darkness enters!",
["Morgyn"]="RPGBooks Cymru Welcomes a Guest OP - Morgyn from RPGmadhouse.no-ip.org",
["Kyoya"]="RPGBooks Cymru Welcomes a Guest OP - Kyoya from RPGmadhouse.no-ip.org",
["Spider"]="Spider has entered the Hub, put all small mammals away!!!",
["fortywinks"]="The slumbering tones of Fortywinks graces the hub",
["Tumnakitty"]="Welcome, my daughter and servant... soft be your feline footfalls, Tumnakitty"
};


rules = "\r\n"..
"                                   Rules \r\n"..
"\r\n"..
"Failure to comply with these rules will mean perm bans from this hub.\r\n"..
"\r\n"..
"01. You must share at least 50MB of Applicable Files. (RPG, Video, MP3)\r\n"..
"02. Please speak English *only* in the main chat. We realize that not everyone is fluent in it, be hey, look at it as a learning experience !\r\n"..
"03. Zero Porn Toleration. This means your run-of-the-mill stuff Hentai, Disney toons, or anything similar. You will receive one warning. Then you will be banned. Sick porn, teen porn, and/or kiddie porn will all be banned without warning or absolution. \r\n"..
"04. Don't use excessive Caps in main chat, don't change your nick, do not flood or spam, and do not post ads for other hubs.\r\n"..
"05. Slotlocking or faksesharing will result in an immediate and permanent ban. No questions asked.\r\n"..
"06. Download speed limiters (shown as B: or L: in desc tags) are not allowed in this hub it will lead to a ban. \r\n"..
"07. 3 kicks will lead to automatic ban!\r\n"..
"08. No racist propaganda or music.\r\n"..
"09. Don't share installed Games/Programs files or incomplete files \r\n"..
"10. Don't share .VOB-files \r\n"..
"11. Don't share *.eml or *.pst-files (your e-mail files). Besides being stupid to share your private e-mail, they may contain viruses.\r\n"..
"12. Don't close other users from downloading. (If you must do it, then give them a good reason!)\r\n"..
"13. Don't flood or spam the chat.\r\n"..
"14. Don't attack other hub users in the main chat. Chat nice or don't chat at all!\r\n"..
"15. Don't ask for OP. we'll ask you :)\r\n"

function Main() 
	frmHub:UnregBot(BOTName) 
	frmHub:RegBot(BOTName) 
	SendToAll(BOTNameInfo)
	AddProfile("Moderator", 4269273088)
	AddProfile("Guest", 2148028000)
end 

function DoRead(user)
	while 1 do 
		pline = read() 
		if pline == nil then break end
			user:SendPM(BOTName, pline)
		end 
	readfrom() 
end

function MyInfoString(data)
	s,e,description,speed,email,share = strfind(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
	speed = strsub(speed,1,strlen(speed)-1) 
	return description,speed,email,share
end

--------- Op Connected ---------
function OpConnected(user)
	description,speed,email,share=MyInfoString(user.sMyInfoString)
	local share2 = share / (1024*1024*1024)
	if (user.sName == "Stravides") then SendToAll(BOTName,""..stravides1.."")	
		elseif (user.sName == "Malevolence") then SendToAll(BOTName, ""..malevolence1.."") 
		elseif (user.sName == "Blumpy") then SendToAll(BOTName, ""..blumpy1.."") 
		elseif (user.sName == "Feuer_Frei") then SendToAll(BOTName, ""..feuer_frei1.."") 
		elseif (user.sName == "Tumnakitty") then SendToAll("Bast", ""..tumnakitty1.."") 
		elseif (user.sName == "Findor_Tallwillow") then SendToAll(BOTName, ""..findor_tallwillow1.."") 
		elseif (user.sName == "Sniffy") then SendToAll(BOTName, ""..sniffy1.."") 
		elseif (user.sName == "Reload3d") then SendToAll(BOTName, ""..reload3d1.."") 
	else    SendToAll(BOTName, "[OPS] "..user.sName.." has joined the hub") 
	end
end

			
-- Op Disconnected 
function OpDisconnected(user)
	description,speed,email,share=MyInfoString(user.sMyInfoString)
	local share2 = share / (1024*1024*1024)

	if (user.sName == "Stravides") then SendToAll(BOTName,""..stravides2.."")	
		elseif (user.sName == "Malevolence") then SendToAll(BOTName, ""..malevolence2.."") 
		elseif (user.sName == "Blumpy") then SendToAll(BOTName, ""..blumpy2.."") 
		elseif (user.sName == "Feuer_Frei") then SendToAll(BOTName, ""..feuer_frei2.."") 
		elseif (user.sName == "Tumnakitty") then SendToAll("Bast", ""..tumnakitty2.."") 
		elseif (user.sName == "Findor_Tallwillow") then SendToAll(BOTName, ""..findor_tallwillow2.."") 
		elseif (user.sName == "Sniffy") then SendToAll(BOTName, ""..sniffy2.."") 
		elseif (user.sName == "Reload3d") then SendToAll(BOTName, ""..reload3d2.."") 
		elseif user.iProfile == 1 then SendToAll(BOTName, "[OP] "..user.sName.." Has Left the Hub")  
	end
end

-- Vip Connected
function NewUserConnected(user)
	if (user.sName == "Morgyn") then SendToAll(BOTName,""..morgyn1.."")	
		elseif (user.sName == "Kyoya") then SendToAll(BOTName, ""..kyoya1.."") 
		elseif (user.sName == "Warian") then SendToAll(BOTName, ""..warian1.."") 
		elseif (user.sName == "Spider") then SendToAll(BOTName, ""..spider1.."") 
		elseif (user.sName == "fortywinks") then SendToAll(BOTName, ""..fortywinks1.."") 
		elseif user.iProfile == 2 then SendToAll(BOTName, "[VIP] "..user.sName..", "..line.." ")  
		elseif user.iProfile == nil then SendToNick(BOTName, ""..user.sName.." has Connected" )
	end
end

-- Vip Disconnected
function UserDisconnected(user)

	if (user.sName == "Morgyn") then SendToAll(BOTName,""..morgyn2.."")	
		elseif (user.sName == "Kyoya") then SendToAll(BOTName, ""..kyoya2.."") 
		elseif (user.sName == "Warian") then SendToAll(BOTName, ""..warian2.."") 
		elseif (user.sName == "Spider") then SendToAll(BOTName, ""..spider2.."") 
		elseif (user.sName == "fortywinks") then SendToAll(BOTName, ""..fortywinks2.."") 
		elseif user.iProfile == 2 then SendToAll(BOTName, "[VIP] "..user.sName..", "..line2.." ")  
	end
end

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")

		if cmd == prefix.."changelogin" then
			_,_,cmd,message = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
			SendToAll(BOTName, "New Login :> "..message)	
		
		elseif cmd == prefix.."changelogout" then
			user:SendPM(BOTName,"Your Logout Message has been changed")
			return 1
		elseif cmd == "!rules" then
			user:SendPM(BOTName,rules)
			return 1
		elseif (cmd == prefix.."displaytable" ) then
			SendToAll(BOTName,UserTable[user.sName])
		return 1
		
		elseif (cmd == prefix.."myip" ) then
			user:SendData(BOTName,"Your preciousssss IP issssss: "..user.sIP)
			return 1
		elseif (cmd == prefix.."mmop" ) then
			_,_,cmd,message = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
			if user.iProfile == 1 or user.iProfile == 0 or user.iProfile == 4 then 
			SendPmToOps(user.sName, message)
			return 1
		end end
	end
end

Getting there slowly
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

Stravides

Just looking for the next installment of this tutorial :)

many thanks

Stravides
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

plop

ok next 1.
what you now have is an asosiative table, complex word for something simple.
in that example script the letter i was a counter, used 2 check if a number was in the table.
the numbers in the table were the so called key's, the 1 was there vallue.
there is was just a dummy vallue, but in your script were gone use real vallue's, the welcome text.
like you allready made.
what were gone do is place a check if the username is in the table and if yes were gone extract and use the vallue.
the way 2 check if something is in the table you allready know and using it goes the same way.
SendToAll(Bot, table)
if the user isn't in the table were gone need the standard welcome text.
good luck

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Stravides

Ok heres the file that does that, spose we could put that into the messages.cfg file now, but i've left it in main code for you to see...

but we can look at that once we look at the users modifyin their own scripts I suppose..  keep it in the one script for now :)

--    Variables  
BOTName="Smeagol"
HubAdress = "RPGBooks-Cymru.no-ip.org"
ScriptVersion = "Stripped Version V6.99" 
BOTNameInfo = "$MyINFO $ALL "..BOTName.." <++V:1.3 Stravides $ $Black Light"..strchar( 1 ).."$Stravides@RPGBooks-Cymru.no-ip.org$" 
version = BOTName.." "..ScriptVersion 
prefix = "!"

ptokaxcommands = {
	op = 1, drop = 1, ban = 1, unban = 1, nickban = 1, getbanlist = 1,
	getinfo = 1, gag = 1, ungag = 1, banip = 1, ipinfo = 1, iprangeinfo = 1,
	userinfo = 1, clrtempban = 1, stat = 1 }

ptokax2commands = {
	clrpermban = 1, topic = 1, reloadtxt = 1 }

-- dofile("messages.cfg");  -- this will hold the tables below

OPLoginTable = { 
["Stravides"]="TBL - The Heavens hathed opened and thus vomitted forth the hapless figure of Stravides",
["Malevolence"]="Bow down and Cower for Malevolence has arrived..",
["Blumpy"]="From the festering brown froth of the sewers, the Overlord of Faeces, Blumpy, emerges.",
["Findor_Tallwillow"]="Beware, fakers, slot-lockers and other lamers... Findor_Tallwillow is here to give you a quick trip to the Abyss... If you aren't one of the above, then smile, and have a good day! :)",
["Sniffy"]="Best be on yer best behaviour as Mrs Sniffy has arrived..",
["Reload3d"]="A large dog looms over, twitches, moans and chuffs up the steaming body of Reload3d - eeeeew",
["Feuer_Frei"]="Misfits & Miscreants beware! Feuer_Frei is here to check your share!!",
["Tumnakitty"]="Welcome, my daughter and servant... soft be your feline footfalls, Tumnakitty",
};

OPLogoutTable = { 
["Stravides"]="And thus it had to come to an end, dont cry, for Stravides will return",
["Malevolence"]="Where's that mangy chufter Malevolence off to, no doubt he will return soon",
["Blumpy"]="Blumpy flushes himself back to the kingdom of the Brown River",
["Findor_Tallwillow"]="Necromancer heaves a sigh of relief as Findor leaves and invites the rule-breakers back into the hub. If they Dare...",
["Sniffy"]="Phew now that the wife, Sniffy has left I can relax in my slippers",
["Reload3d"]="The taint of Reload3d is no more...",
["Feuer_Frei"]="Feuer_Frei hath departed!!",
["Tumnakitty"]="Alas, I call to me Tumnakitty,the firecat that follows my lead...",
};

VIPLogInTable = {
["Warian"]="Warian - The one who is all that which stands for that which is the epitome` of that which is The World of [Darkness enters!",
["Morgyn"]="RPGBooks Cymru Welcomes a Guest OP - Morgyn from RPGmadhouse.no-ip.org",
["Kyoya"]="RPGBooks Cymru Welcomes a Guest OP - Kyoya from RPGmadhouse.no-ip.org",
["Spider"]="Spider has entered the Hub, put all small mammals away!!!",
["fortywinks"]="The slumbering tones of Fortywinks graces the hub",
};

VIPLogOutTable = {
["Warian"]="Warian - The World of Darkness Guru has left, and taken his Weremidgets with him!",
["Morgyn"]="Bid Farewell to the VIP Morgyn from RPGmadhouse.no-ip.org",
["Kyoya"]="Bid Farewell to the VIP Kyoya from RPGmadhouse.no-ip.org",
["Spider"]="As the Sun goes down, the reflections cease from Spider as he logs off..",
["fortywinks"]="As Fortywinks leaves, he casts a farewell wave..",
};

rules = "\r\n"..
"                                   Rules \r\n"..
"\r\n"..
"Failure to comply with these rules will mean perm bans from this hub.\r\n"..
"\r\n"..
"01. You must share at least 50MB of Applicable Files. (RPG, Video, MP3)\r\n"..
"02. Please speak English *only* in the main chat. We realize that not everyone is fluent in it, be hey, look at it as a learning experience !\r\n"..
"03. Zero Porn Toleration. This means your run-of-the-mill stuff Hentai, Disney toons, or anything similar. You will receive one warning. Then you will be banned. Sick porn, teen porn, and/or kiddie porn will all be banned without warning or absolution. \r\n"..
"04. Don't use excessive Caps in main chat, don't change your nick, do not flood or spam, and do not post ads for other hubs.\r\n"..
"05. Slotlocking or faksesharing will result in an immediate and permanent ban. No questions asked.\r\n"..
"06. Download speed limiters (shown as B: or L: in desc tags) are not allowed in this hub it will lead to a ban. \r\n"..
"07. 3 kicks will lead to automatic ban!\r\n"..
"08. No racist propaganda or music.\r\n"..
"09. Don't share installed Games/Programs files or incomplete files \r\n"..
"10. Don't share .VOB-files \r\n"..
"11. Don't share *.eml or *.pst-files (your e-mail files). Besides being stupid to share your private e-mail, they may contain viruses.\r\n"..
"12. Don't close other users from downloading. (If you must do it, then give them a good reason!)\r\n"..
"13. Don't flood or spam the chat.\r\n"..
"14. Don't attack other hub users in the main chat. Chat nice or don't chat at all!\r\n"..
"15. Don't ask for OP. we'll ask you :)\r\n"

function Main() 
	frmHub:UnregBot(BOTName) 
	frmHub:RegBot(BOTName) 
	SendToAll(BOTNameInfo)
	AddProfile("Moderator", 4269273088)
	AddProfile("Guest", 2148028000)
end 

function DoRead(user)
	while 1 do 
		pline = read() 
		if pline == nil then break end
			user:SendPM(BOTName, pline)
		end 
	readfrom() 
end

function MyInfoString(data)
	s,e,description,speed,email,share = strfind(data, "$MyINFO $ALL ([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
	speed = strsub(speed,1,strlen(speed)-1) 
	return description,speed,email,share
end

--------- Begin Connection Functions ---------

function OpConnected(user)
	description,speed,email,share=MyInfoString(user.sMyInfoString)
	local share2 = share / (1024*1024*1024)
	if OPLoginTable[user.sName] then SendToAll(BOTName,OPLoginTable[user.sName])	
	else    SendToAll(BOTName, "[OPS] "..user.sName.." has joined the hub") 
	end
end

function OpDisconnected(user)
	description,speed,email,share=MyInfoString(user.sMyInfoString)
	local share2 = share / (1024*1024*1024)
	if OPLogoutTable[user.sName] then SendToAll(BOTName,OPLogoutTable[user.sName])	
		elseif user.iProfile == 1 then SendToAll(BOTName, "[OP] "..user.sName.." Has Left the Hub")  
	end
end

function NewUserConnected(user)
	if VIPLogInTable[user.sName] then SendToAll(BOTName,VIPLogInTable[user.sName])	
	elseif user.iProfile == 2 then SendToAll(BOTName, "[VIP] "..user.sName..", has Connected")  
	elseif user.iProfile == nil then SendToNick(BOTName, ""..user.sName..", has Connected" )
	end
end

function UserDisconnected(user)
	if VIPLogOutTable[user.sName] then SendToAll(BOTName,VIPLogOutTable[user.sName])	
	elseif (user.sName == "fortywinks") then SendToAll(BOTName, ""..fortywinks2.."") 
	elseif user.iProfile == 2 then SendToAll(BOTName, "[VIP] "..user.sName..", has Disconnected")  
	end
end

--------- End Connection Functions ---------

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")

		if cmd == prefix.."changelogin" then
			_,_,cmd,message = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
			SendToAll(BOTName, "New Login :> "..message)	
		
		elseif cmd == prefix.."changelogout" then
			user:SendPM(BOTName,"Your Logout Message has been changed")
			return 1
		elseif cmd == "!rules" then
			user:SendPM(BOTName,rules)
			return 1
		elseif (cmd == prefix.."myip" ) then
			user:SendData(BOTName,"Your preciousssss IP issssss: "..user.sIP)
			return 1
		elseif (cmd == prefix.."mmop" ) then
			_,_,cmd,message = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
			if user.iProfile == 1 or user.iProfile == 0 or user.iProfile == 4 then 
			SendPmToOps(user.sName, message)
			return 1
		end end
	end
end

many thanks - eagerly awaiting next chapter :)
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

plop

oki your doing great, got just 1 small hint.
try tabbing a bit better.
function OpConnected(user)
   description,speed,email,share=MyInfoString(user.sMyInfoString)
   local share2 = share / (1024*1024*1024)
   if OPLoginTable[user.sName] then
      SendToAll(BOTName,OPLoginTable[user.sName])
   else
      SendToAll(BOTName, "[OPS] "..user.sName.." has joined the hub")
   end
end
this is much easyer 2 read.

now were gone make it posible for the op's 2 change there welcome.
this is again really simple.
OPLoginTable[user.sName]="New welcome text"
can't make it more complex then this. lol
after that were gone save it 2 a file (in the most simple way so you also learn some more pattern matching on loading it again).

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Stravides

Sorry I dont understand what you mean,

please can you explain as I'm not sure what you require me to do next..  the rest was fairly easy, but I'm not too clear on the next steps.

i assume that the user will type something like !changelogin this is my new text

and the DataArrival needs to check for the string after that somehow

that I think I can do, but the file manipulation I'm not sure about at all.  Might help if you can gimme a quick write and read help, after all I only wanna ammend the line that is equal to the current user dont i ?

regards in stupidity :)

Stravides
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

Stravides

General gist of the code will be in dataarrival

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")

		if cmd == prefix.."changelogin" then
			_,_,cmd,message = strfind( data, "%b<>%s+(%S+)%s+(.+)" )
			if OPLoginTable[user.sName] then  
				OPLogoutTable[user.sName] = message
 				SendToAll(BOTName,"Login changed to: "..OPLogoutTable[user.sName])
			end
		elseif cmd == prefix.."changelogout" then

I know the    OPLogoutTable[user.sName] = message will only change it for there and then, but I do not know how to change the table perm. can you assist in this but ;)

regards
Stravides
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

SMF spam blocked by CleanTalk