PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: 6Marilyn6Manson6 on 24 December, 2004, 12:22:05

Title: Easy script... very easy
Post by: 6Marilyn6Manson6 on 24 December, 2004, 12:22:05
Hello I have little problem... I have this script:


--Bot ideato da 6Marilyn6Manson6 per il suo splendido amore ???L&J??? il 24 / 12 / 2004 alle 11.42
--Solo ???L&J??? pu? usare il comando azione
--Ah... dimenticavo: ???L&J??? TI AMO by JO ^__^
BotName="???UnaGocciaNell'Oceano???"
botspeed = "???UnaGocciaNell'Oceano???"

function Main()
frmHub:RegBot(BotName)
end

function GetCommand(message)
s,e,command=strfind(message,"(%S+)")
return command
end
function GetOneParam(message)
s,e,param1=strfind(message,"%S+%s(.*)")
return param1
end
function DataArrival(curUser, data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
s,e,message = strfind( data, "%b<>%s+(.*)")
command=GetCommand(message)
if (curUser.iProfile) == 0 and (curUser.sName) == Scripter then
if (command=="!amore") then
masstext=GetOneParam(message)
if (masstext~=nil) then
curUser:SendPM(BotName,"Un dolce messaggio da ???L&J???:")
SendPmToAll(BotName,masstext.."  by "..curUser.sName)
return 1
else
curUser:SendPM(BotName,"Amore mio... hai sbagliato comando. La stringa giusta ? : !amore [ricorda che TI AMO   by JO]")
end
end
end
end
end


but... If I have this:


--Bot ideato da 6Marilyn6Manson6 per il suo splendido amore ???L&J??? il 24 / 12 / 2004 alle 11.42
--Solo ???L&J??? pu? usare il comando azione
--Ah... dimenticavo: ???L&J??? TI AMO by JO ^__^
BotName="???UnaGocciaNell'Oceano???"
botspeed = "???UnaGocciaNell'Oceano???"

function Main()
frmHub:RegBot(BotName)
end

function GetCommand(message)
s,e,command=strfind(message,"(%S+)")
return command
end
function GetOneParam(message)
s,e,param1=strfind(message,"%S+%s(.*)")
return param1
end
function DataArrival(curUser, data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
s,e,message = strfind( data, "%b<>%s+(.*)")
command=GetCommand(message)
if (curUser.iProfile) == 0 and (curUser.sName) == ???L&J??? then
if (command=="!amore") then
masstext=GetOneParam(message)
if (masstext~=nil) then
curUser:SendPM(BotName,"Un dolce messaggio da ???L&J???:")
SendPmToAll(BotName,masstext.."  by "..curUser.sName)
return 1
else
curUser:SendPM(BotName,"Amore mio... hai sbagliato comando. La stringa giusta ? : !amore [ricorda che TI AMO   by JO]")
end
end
end
end
end

I have error in line 24... why? thanks
Title:
Post by: [_XStaTiC_] on 24 December, 2004, 12:49:52
change this line
if (curUser.iProfile) == 0 and (curUser.sName) == ???L&J??? then

to

if (curUser.iProfile) == 0 and (curUser.sName) == "???L&J???" then



happy X-mas 2@ll
Title:
Post by: Optimus on 24 December, 2004, 13:10:10
Quotes,e,command=strfind(message,"(%S+)")
small improvement you could do is to make all stringfinds local

Example:

local s,e,command=strfind(message,"(%S+)")

local s,e,param1=strfind(message,"%S+%s(.*)")

local s,e,message = strfind( data, "%b<>%s+(.*)")

local command=GetCommand(message)

Cheers;)
Title:
Post by: 6Marilyn6Manson6 on 24 December, 2004, 14:57:45
Thanks a lot Optimus ;)
Thanks a lot XSTETIC
thanks thanks ;)
Title:
Post by: 6Marilyn6Manson6 on 25 December, 2004, 17:20:39
Hello, I have request for my script:

--Bot ideato da 6Marilyn6Manson6 per il suo splendido amore ???L&J??? il 24 / 12 / 2004 alle 11.42
--Solo ???L&J??? pu? usare il comando azione
--Ah... dimenticavo: ???L&J??? TI AMO by JO ^__^
BotName="???UnaGocciaNell'Oceano???"
botspeed = "???UnaGocciaNell'Oceano???"

function Main()
frmHub:RegBot(BotName)
end

function GetCommand(message)
local s,e,command=strfind(message,"(%S+)")
return command
end
function GetOneParam(message)
local s,e,param1=strfind(message,"%S+%s(.*)")
return param1
end
function DataArrival(curUser, data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
local s,e,message = strfind( data, "%b<>%s+(.*)")
local command=GetCommand(message)
if (curUser.iProfile) == 0 and (curUser.sName) == "???L&J???" then
if (command=="!amore") then
local masstext=GetOneParam(message)
if (masstext~=nil) then
curUser:SendPM(BotName,"Un dolce messaggio da ???L&J???:")
SendPmToAll(BotName,masstext.."  by "..curUser.sName)
return 1
else
curUser:SendPM(BotName,"Amore mio... hai sbagliato comando. La stringa giusta ? : !amore [ricorda che TI AMO   by JO]")
end
end
end
end
end

I want add information of bot... share, description, email, connection type... Thanks
Title:
Post by: Optimus on 25 December, 2004, 17:24:16
I changed your script above so the variables are local that is better and faster. This way they are removed from memory after they are used.

Sorry had to do that lOOL
Title:
Post by: 6Marilyn6Manson6 on 25 December, 2004, 17:26:52
I don't understand :P
Title:
Post by: Optimus on 25 December, 2004, 17:37:07
Take a closer look at the script you posted i changed it there. You will see what i changed then
Title:
Post by: 6Marilyn6Manson6 on 25 December, 2004, 17:40:09
Example I want this:


--Bot ideato da 6Marilyn6Manson6 per il suo splendido amore ???L&J??? il 24 / 12 / 2004 alle 11.42
--Solo ???L&J??? pu? usare il comando azione
--Ah... dimenticavo: ???L&J??? TI AMO by JO ^__^
BotName="???UnaGocciaNell'Oceano???"
botspeed = "???UnaGocciaNell'Oceano???"

function Main()
frmHub:RegBot(BotName)
Bot_Share_Size = 0.0 * 1024 *1024
Bot_email = "6marilyn6manson6@aliceposta.it"
Bot_Speed = "DSL"
Bot_TAG = "< AmOrE : V:0.1 >"
Bot_Descr = "< Made by: 6Marilyn6Manson6 >"
end

function GetCommand(message)
s,e,command=strfind(message,"(%S+)")
return command
end
function GetOneParam(message)
s,e,param1=strfind(message,"%S+%s(.*)")
return param1
end
function DataArrival(curUser, data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
s,e,message = strfind( data, "%b<>%s+(.*)")
command=GetCommand(message)
if (curUser.iProfile) == 0 and (curUser.sName) == "???L&J???" then
if (command=="!amore") then
masstext=GetOneParam(message)
if (masstext~=nil) then
curUser:SendPM(BotName,"Un dolce messaggio da ???L&J???:")
SendPmToAll(BotName,masstext.."  by "..curUser.sName)
return 1
else
curUser:SendPM(BotName,"Amore mio... hai sbagliato comando. La stringa giusta ? : !amore [ricorda che TI AMO   by JO]")
end
end
end
end
end


not have syntax error...... but information not found :(
Title:
Post by: Madman on 25 December, 2004, 19:15:25
--Bot ideato da 6Marilyn6Manson6 per il suo splendido amore ???L&J??? il 24 / 12 / 2004 alle 11.42
--Solo ???L&J??? pu? usare il comando azione
--Ah... dimenticavo: ???L&J??? TI AMO by JO ^__^

BotName="???UnaGocciaNell'Oceano???"
BotEmail = "6marilyn6manson6@aliceposta.it"
BotSpeed = "DSL"
BotTag = "< AmOrE : V:0.1 >"
MyInfoString = "$MyINFO $ALL "..BotName.." "..BotTag.."$ $"..BotSpeed..strchar( 1 ).."$"..BotEmail.."$"

function Main()
frmHub:RegBot(BotName)
SendToAll(MyInfoString)
end

function GetCommand(message)
local s,e,command=strfind(message,"(%S+)")
return command
end

function GetOneParam(message)
local s,e,param1=strfind(message,"%S+%s(.*)")
return param1
end

function DataArrival(curUser, data)
if( strsub(data, 1, 1) == "<" ) then
data=strsub(data,1,strlen(data)-1)
local s,e,message = strfind( data, "%b<>%s+(.*)")
local command=GetCommand(message)
if (curUser.iProfile) == 0 and (curUser.sName) == "???L&J???" then
if (command=="!amore") then
local masstext=GetOneParam(message)
if (masstext~=nil) then
curUser:SendPM(BotName,"Un dolce messaggio da ???L&J???:")
SendPmToAll(BotName,masstext.."  by "..curUser.sName)
return 1
else
curUser:SendPM(BotName,"Amore mio... hai sbagliato comando. La stringa giusta ? : !amore [ricorda che TI AMO   by JO]")
end
end
end
end
end

That should work... =)
No need to write  BotShare, it will get 0 anyway...
Title:
Post by: 6Marilyn6Manson6 on 25 December, 2004, 19:34:35
madman thanks a lot ^__^
Title:
Post by: Optimus on 25 December, 2004, 20:31:24
6Marilyn6Manson6 i need to say this.

if you wane learn something you need to listen better to the advice you have been given. I even gave away the hint how todo it.

And what do i see you post the same ugly script with out the locals again. hum hum

Is it so hard to read/listen and following advice you have been given.

You now give me the idea to not help you any more cause it is a wast of time.

Is that what you want?

You can learn so much on this forum but you just don't see it or care.

This is just a advice you don't need to follow it.

Greetingz Optimus
Title:
Post by: 6Marilyn6Manson6 on 25 December, 2004, 20:48:35
No optimus no no.... I want your help and of all... I'm not have seed your changes, and i'm really sorry for this. I'm sorry for all... It's don't happen again...Sorry