PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: CraKteR on 16 August, 2004, 21:23:27

Title: Welcome bot
Post by: CraKteR on 16 August, 2004, 21:23:27
Im a Newbie so I have just starting using Lua script so what is wrong in this Script ?

Bot= "-Welcome-"
Prefix1 = "!" -- Command Prefix

function DataArrival(curUser, data)
frmHub:RegBot(Bot)
s,e,msg = strfind(data, "%b<>%s+%S+%s+(.*)")
if msg == nil or msg=="" then
curUser:SD(BotName,CmdErrorMsg.." "..Prefix1.."welcome :"..CmdErrorPar)
return 1
end
Welcome[curUser.sName] = msg
SaveToFile(WelcomeFile , Welcome , "Welcome")
curUser:SD(BotName,MsgAdd.." \r\n \r\n \t "..msg.." \r\n")
return 1
end
Title:
Post by: Snooze on 16 August, 2004, 22:04:35
QuoteIm a Newbie so I have just starting using Lua script so what is wrong in this Script ?

Umm.. what exactly did you want this script to do ?


Snooze
Title:
Post by: CraKteR on 16 August, 2004, 23:23:27
It`s a script that a OP/VIP can choose his/her own welcome message..!
like "!welcome Here comes [OP]CraKteR" or so..!

Then it would be like  <-=Pamela=-> Here comes [OP]CraKteR! In main.. when i connect.. and so on to the people that have own welcome messages
Title:
Post by: Herodes on 17 August, 2004, 00:52:25
I would first recomend to see how other ppl have done this ...

there are many many errors in this script that justify that it shouldnt work ...

You will find great help in other ppls scripts and the Scripting.txt in the PtokaX/docs folder ...

Also try watching how the functions, variables, string operations work.

I also recommend learning by heart the tutorials in the HOWTO section of this forum .... especially the
"Build your Own Bot" series from Phatty and the plops tutorials about tables (this should come a bit later..:) and strsub along with pattern matching ...

Welcome and I hope your knowledge and wits grow along with ours :)