PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: pHaTTy on 16 February, 2004, 03:42:31

Title: Random Intro/Outro
Post by: pHaTTy on 16 February, 2004, 03:42:31
random intro message bot i wrote for gekko here is the source ;) was wrote a while back, just frgot to write as a stand alone ;)

--//Random In/Out(tro) bot By Phatty

dBot = "GeX"

function OpConnected(user)
reply = Random(user)
SendToAll(dBot,reply)
end

function Random(user)
test = random(9)
x1 = user.sName.." appears from the darkness"
x2 = user.sName.." walks out from the darkness"
x3 = "ALL YOUR BASE ARE BELONG TO "..user.sName
x4 = user.sName.." walks in covered in something"
x5 = user.sName.." blah"
x6 = user.sName.." more blah"
x7 = user.sName.." some more blah"
x8 = user.sName.." blah blah"
x9 = user.sName.." even more blah"
dostring("ret=x"..test)
return ret
end

enjoy ;)
Title:
Post by: pHaTTy on 16 February, 2004, 04:11:53
update

--//Random In/Out(tro) bot By Phatty
--//RINOUR(TRO) v1.01

howmany = "3" --set to how many x1,2,3,4,5 u have

--//start here x1,x2,x3 etc
x1 = "[USER] appears from the darkness"
x2 = "[USER] walks out from the darkness"
x3 = "ALL YOUR BASE ARE BELONG TO [USER]"
--//end

dBot = "GeX"

function OpConnected(user)
reply = Random(user)
SendToAll(dBot,reply)
end

function Random(user)
test = random(howmany)
dostring("ret=x"..test)
ret=gsub(ret,"%b[]", user.sName)
return ret
end
Title:
Post by: NightLitch on 16 February, 2004, 12:26:25
Nice Phatty, but a question for my bot.

Can I use the same principal for creating my multilang ??

or how have you all done it ??

wanna now plz.

/NL
Title:
Post by: pHaTTy on 16 February, 2004, 12:36:52
QuoteOriginally posted by NightLitch
Nice Phatty, but a question for my bot.

Can I use the same principal for creating my multilang ??

or how have you all done it ??

wanna now plz.

/NL

using dostring yes ;)
Title:
Post by: pHaTTy on 16 February, 2004, 12:46:45
QuoteOriginally posted by NightLitch
Nice Phatty, but a question for my bot.

Can I use the same principal for creating my multilang ??

or how have you all done it ??

wanna now plz.

/NL

altho it depends on what you are doing, like most bots just have the hub language, Gekko and ChannelBot have user language

so each user may choose a language, which are you trying to get to?
Title:
Post by: NightLitch on 16 February, 2004, 13:04:25
How should I say it hmm;

I want HubOwners to select their language for the script.

I want to make a Langfile.lan with all my text from the bot. is that good enough explaination ?

Seperatly for each user I will look at later now this is my main, priority, have solved the table structuring for the commands, but the lang. is left to do.

thx for the help Phatty.

/NL
Title:
Post by: pHaTTy on 16 February, 2004, 13:10:29
QuoteOriginally posted by NightLitch
How should I say it hmm;

I want HubOwners to select their language for the script.

I want to make a Langfile.lan with all my text from the bot. is that good enough explaination ?

Seperatly for each user I will look at later now this is my main, priority, have solved the table structuring for the commands, but the lang. is left to do.

thx for the help Phatty.

/NL

well for owners todo it, u might as well add for all users cause otherwise it means more code....
Title:
Post by: NightLitch on 16 February, 2004, 13:12:42
hehe you missunderstod me.

I mean the hubowner select in the script with will be the lang. for all. not only for him. or what?? hehe little dizzy here... :-)
Title:
Post by: pHaTTy on 16 February, 2004, 13:18:06
oh ok, well in that case just use strings, so every phrase in script change with for example

SendToAll(Bot,"some tosser named eternal flame is a dumbass")

change to

--lan file
DumbAss = "some tosser named eternal flame is a dumbass
--dofile this file ;)

SendToAll(Bot,DumbAss)
Title:
Post by: NightLitch on 16 February, 2004, 13:21:43
Yes but what about when having this:

curUser:SD(BotName,"You share "..UserGB/gb.." Gb")
Title:
Post by: pHaTTy on 16 February, 2004, 13:43:06
QuoteOriginally posted by NightLitch
Yes but what about when having this:

curUser:SD(BotName,"You share "..UserGB/gb.." Gb")

well u can use gsub for that ;) altho for that

curUser:SD(BotName,"You share "..UserGB/gb.." Gb")

word = "You Share "

curUser:SD(BotName,word..UserGB/gb.." Gb")
Title:
Post by: NightLitch on 16 February, 2004, 13:45:05
I was thinking with a function like this:

function Lang(string,value)
dostring(string)
lang=gsub(string,"%b[]", value)
return lang
end

but don't know if it work as it should becouse haven't tested it yet.
Title:
Post by: pHaTTy on 16 February, 2004, 13:49:31
hmm depends on how many [] u gonna have per line but yep shud work :)
Title:
Post by: NightLitch on 16 February, 2004, 13:53:16
Getting error why:



function OpConnected(curUser)
TEST = "Test to [USER] if gsub text"
curUser:SendData(BotName,"TEst to "..curUser.sName.." regual text")
lang = Lang(TEST,curUser.sName)
curUser:SendData(BotName,lang)

end


function Lang(string,value)
dostring(string)
lang=gsub(string,"%b[]", value)
return lang
end

ERROR:
Syntax error: `=' expected;
  last token read: `to' at line 1 in string "Test to [USER] if gsub text"
stack traceback:
   1:  function `dostring' [C]
   2:  function `Lang' at line 982 [file `C:\PtokaX\scripts\NXS-3.lua']
   3:  function `OpConnected' at line 258 [file `C:\PtokaX\scripts\NXS-3.lua']


why bro ??
Title:
Post by: NightLitch on 16 February, 2004, 13:55:11
sorry btw for messing up this thread... but you can delete this after I get it... :-) hope you don't mind.
Title:
Post by: pHaTTy on 16 February, 2004, 14:01:55
QuoteOriginally posted by NightLitch
Getting error why:



function OpConnected(curUser)
TEST = "Test to [USER] if gsub text"
curUser:SendData(BotName,"TEst to "..curUser.sName.." regual text")
lang = Lang(TEST,curUser.sName)
curUser:SendData(BotName,lang)

end


function Lang(string,value)
dostring(string)
lang=gsub(string,"%b[]", value)
return lang
end

ERROR:
Syntax error: `=' expected;
  last token read: `to' at line 1 in string "Test to [USER] if gsub text"
stack traceback:
   1:  function `dostring' [C]
   2:  function `Lang' at line 982 [file `C:\PtokaX\scripts\NXS-3.lua']
   3:  function `OpConnected' at line 258 [file `C:\PtokaX\scripts\NXS-3.lua']


why bro ??

because dostring has tobe a string like test= something
Title:
Post by: pHaTTy on 16 February, 2004, 14:04:17
like errmuhmm


function OpConnected(curUser)
TEST = "Test to [USER] if gsub text"
curUser:SendData(BotName,"TEst to "..curUser.sName.." regual text")
lang = Lang(TEST,curUser.sName)
curUser:SendData(BotName,lang)

end


function Lang(string,value)
dostring("xl="..string)
lang=gsub(xl,"%b[]", value)
return xl
end

Title:
Post by: NightLitch on 16 February, 2004, 14:19:21
this worked:
function Lang(string,value)
-- dostring(string)
lang=gsub(string,"%b[]", value)
return lang
end

but not yours... that I find strange.
Title:
Post by: pHaTTy on 16 February, 2004, 14:20:34
hmmm :s ok well as long as u got it working eh :)
Title:
Post by: NightLitch on 16 February, 2004, 14:23:59
Yepp, if I get errors I blame on you then ;-p hehe...

No, Thx for the help bro, And must say, Am glad you're still here.

You where about to leave us. But we pulled you back here. :-)

Have a nice day m8 / NL
Title:
Post by: pHaTTy on 16 February, 2004, 14:32:45
QuoteOriginally posted by NightLitch
Yepp, if I get errors I blame on you then ;-p hehe...

No, Thx for the help bro, And must say, Am glad you're still here.

You where about to leave us. But we pulled you back here. :-)

Have a nice day m8 / NL

ye lol i still really need toleave its just hard thing todo
Title:
Post by: NightLitch on 16 February, 2004, 16:37:08
How should it be if I want to values:

ex:

function Lang(string,value1,value2)
      lang=gsub(string,"%b[]", value1)
   return lang
end
 

for ex:

curUser:SendData(BotName,curUser.sName.." you are sharing "..UserShare/gb.." Gb")

Line = "[USER] you are sharing [SHARE] Gb"
Title:
Post by: pHaTTy on 16 February, 2004, 16:45:06
hmm not to sure im newbie to gsub :)
Title:
Post by: DorianG on 17 February, 2004, 01:30:03
Sorry phatty i have used this code:

function Opconnected(user)
reply = Random(user)
SendToAll(BotName,reply)
end

function RandomOpMsg(user)
test = random(nummsgop)
x1 = user.sName.." appare dalle tenebre"
x2 = user.sName.." esce fuori da una nube proprio come fanno i ninja"
x3 = "La sua fama lo precede, ? tra noi "..user.sName
x4 = "Tutti lo conoscono tutti ci hanno parlato, ma nessuno in realt? sa chi si cela dientro "..user.sName
x5 = user.sName.." ? entrato, state attenti faker"
x6 = user.sName.." ? qui tra noi, non so voi ma io scappo :D"
x7 = user.sName.." ? arrivato miticooooooooooooo"
x8 = user.sName.." spalanca le porte di "..frmHub:GetHubName().." e con il suo scettro da operatore si prepara a distruggere i faker"
x9 = user.sName.." arriva col suo elicottero e atterra su " ..frmHub:GetHubName
dostring("ret=x"..test)
return ret
end

But Ptokax tell me:  Syntax error: function arguments expected;
  last token read: `dostring' at line 18 in string "function Opconnected(user)
..."

Why???
Title:
Post by: DorianG on 17 February, 2004, 01:33:04
Sorry i have tried my error  :D

frmHub:GetHubName()
Title:
Post by: Madman on 13 March, 2004, 15:41:46
Hi
Great Script.

I was wondering if u could make it to say the Intro/Outro Messege for only users. And not for Vip/Ops.

Please =)
Title:
Post by: pHaTTy on 13 March, 2004, 15:52:46
QuoteOriginally posted by madman
Hi
Great Script.

I was wondering if u could make it to say the Intro/Outro Messege for only users. And not for Vip/Ops.

Please =)



--//Random In/Out(tro) bot By Phatty
--//RINOUR(TRO) v1.01

howmany = "3" --set to how many x1,2,3,4,5 u have

--//start here x1,x2,x3 etc
x1 = "[USER] appears from the darkness"
x2 = "[USER] walks out from the darkness"
x3 = "ALL YOUR BASE ARE BELONG TO [USER]"
--//end

dBot = "GeX"

function NewUserConneced(user)
if user.iProfile == -1 then
reply = Random(user)
SendToAll(dBot,reply)
end
end

function Random(user)
test = random(howmany)
dostring("ret=x"..test)
ret=gsub(ret,"%b[]", user.sName)
return ret
end



enjoy ;)
Title:
Post by: Madman on 13 March, 2004, 20:24:12
Hi
I can the OP script to work but not the user script. It dosent say anything when a new user connect....