PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: RF on 26 January, 2005, 16:50:33

Title: Script with commands like slap, shoot etc etc.
Post by: RF on 26 January, 2005, 16:50:33
Hello, new in here  :))

I have been trying and trying to make a script what would have commands like +slap, +shoot, +kiss etc etc, just few commands.

I have no experience in programming so that must be the reason why i did not get anything to work, so i copied one simple slap script from here and tried to add new commands to it but i always got somekind of error, lost my nervs and now i finally realized that someone in here who would be that kind, could make somekind of simple script to here and tell me how to add simple commands to it.

I will be really appreciated who can make me a simple script like that.

Thanks.

//RF
Title:
Post by: fallen_ on 26 January, 2005, 17:47:52
QuoteOriginally posted by RF
Hello, new in here  :))

I have been trying and trying to make a script what would have commands like +slap, +shoot, +kiss etc etc, just few commands.

I have no experience in programming so that must be the reason why i did not get anything to work, so i copied one simple slap script from here and tried to add new commands to it but i always got somekind of error, lost my nervs and now i finally realized that someone in here who would be that kind, could make somekind of simple script to here and tell me how to add simple commands to it.

I will be really appreciated who can make me a simple script like that.

Thanks.

//RF


--puncher.lua by Romulus 2003-04-12

botname="Ringside"

function DataArrival(user, data)

data=strsub(data,1,strlen(data)-1)

s,e,cmd,arg = strfind(data,"%b<>%s+(%S+)%s+(%S+)")

if (cmd=="!punch") then

if not (arg==nil) then

local tmp = GetItemByName(arg)

if (tmp==nil) then

SendToAll(botname,""..user.sName.." tries to punch "..arg..", but swings in thin air!")

end

if not (tmp==nil) then

SendToAll(botname, ""..user.sName.." socks "..arg.." right in the nose!")

end

return 1

end



end

end
try and change. :)
Title:
Post by: Tw?sT?d-d?v on 26 January, 2005, 18:22:01
You could try madman,s funscript....

it,s very good :))

it has these cmds plus more

you can find this in finished scripts
Title:
Post by: RF on 26 January, 2005, 18:57:42
Thanks for answers guys.

And yes, i have tried funscript but it was not meant to me, if you know what i mean ;)

Let's see if this helps.
Bot = "Slapper"



function DataArrival(curUser, data)

   if strsub(data,1,1) == "<" then

   data=strsub(data,1,strlen(data)-1)

   s,e,cmd,arg = strfind(data,"%b<>%s+(%S+)%s+(.*)")

   
      if cmd=="+slap" then

         SendToAll(Bot, curUser.sName.." slaps "..arg.." with a fresh herring") return 1

       end

    end

end

in which part of that code i need to add other commands (like punch command) if i want them to same script or is it even possible with this sample?

Thanks again.

//RF
Title:
Post by: Madman on 26 January, 2005, 21:32:00
Bot = "Slapper"

function DataArrival(curUser,data)
if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")
---Slap Start
if cmd == "!slap" then --//The Command...
local s,e,victim = strfind(data, "%b<>%s+%S+%s+(%S+)")
if victim == nil then --//Forgot Nick?
curUser:SendData(Bot, "Syntax: "..cmd.." nick") --//If So Send This
return 1 --//Hides The Commands
end
vUser = GetItemByName(victim) --//vUser And Victim Is The Same, Also Checks If Victim Is Online
if not vUser then --//User Wasent online
curUser:SendData(Bot, " *** " ..victim.." is not online or wrong name...") --//Wrong Name, Or USer Offline
return 1
end
SendToAll(Bot, curUser.sName.." slaps "..vUser.sName.." around with a large trout.")--//Do To A User
return 1
end
---Slap End
---Punch Start
if cmd == "!punch" then
local s,e,victim = strfind(data, "%b<>%s+%S+%s+(%S+)")
if victim == nil then
curUser:SendData(Bot, "Syntax: "..cmd.." nick")
return 1
end
vUser = GetItemByName(victim)
if not vUser then
curUser:SendData(Bot, " *** " ..victim.." is not online or wrong name...")
return 1
end
SendToAll(Bot, curUser.sName.." socks "..vUser.sName.." right in the nose!")
return 1
end
---Punch End
end
end

This might help... Just Copy from -- Slap Start to --Slap end and change the command and the text's =)
Title:
Post by: RF on 26 January, 2005, 22:56:49
Thank you madman, that was exactly what i was searching for. :)
Title:
Post by: Madman on 26 January, 2005, 23:09:04
np, always happy to help =)
Title:
Post by: pHaTTy on 01 February, 2005, 13:26:14
not done scripting for a long time, not sureif this is right, but give this a go

--//Mini Fun Bot by Pha
--//v1.00

function Main()
uTrigs = { ["+"]=1,["-"]=1,["!"]=1,["#"]=1 }

uSets = {
--//Later Additions
sName = "sLuT"
}

eCommands = {
["slap"] = {FuncSlap, "Slap a user",1},
["punsh"] = {FuncPunsh, "Punsh a user",1},

}

end;


function CheckUser(ud,dd)
local s,e,victim = strfind(data, "%b<>%s+%S+%s+(%S+)")
if victim == nil then
ud:SendData(eSets.sName, "Syntax: "..cmd.." nick")
return nil
else
user = GetItemByName(victim)
if not user then
ud:SendData(eSets.sName, " *** " ..victim.." is not online or wrong nick...")
return nil
else
return user
end;
end;
end;


function FuncSlap(ud,dd)
user = CheckUser(ud,dd)
if user <> nil then
SendToAll(eSets.sName, ud.sName.." slaps "..user.sName.." around with a large trout.")
end;
return 1;
end;

function FuncPunsh(ud,dd)
user = CheckUser(ud,dd)
if user <> nil then
SendToAll(eSets.sName, ud.sName.." socks "..user.sName.." right in the nose!")
end;
return 1;
end;

function DataArrival(ud,dd)
if strsub(dd, 1, 1) == "<" then
local data=strsub(dd,1,strlen(dd)-1)
local s,e,prefix,cmd = strfind(dd, "%b<>%s+(%S)(%S+)")
if prefix == nil then
return 0;
if eTrigs[prefix] == 1 then
cmd = strlower(cmd)

if eCommands[cmd] then
if eCommands[cmd][4] == 1 then
eCommands[cmd][1](ud,dd)
else
ud:SendData(eSets.sName,"Sorry command is disabled!")
return 1;
end;
end;
end;
end;
end;

-/pha