PtokaX forum

Development Section => HOW-TO's => Topic started by: satya on 27 April, 2008, 12:36:20

Title: pls help meee
Post by: satya on 27 April, 2008, 12:36:20
hey guyss help me out b4 i scratch all my hairs off  :-X

i wanted to learn lua to script in ptokax, i just got a site from this very forum so here is the site wich i m usin for the same
http://wiki.ptokax.ath.cx/doku.php?id=scriptinghelp:ptokaxapi#the_frmhub_object

from this site i have used the xample codes in my hub just take a look at them


function NewUserConnected(user)
user:SendData("Welcome-Bot","Welcome! Have a good time!")
end


function ChatArrival(user,data)
  data=string.sub(data,1,string.len(data)-1) -- remove end pipe
  if string.find(data,"https?://") or string.find(data,"www%.") then -- if this string is found then
    user:SendData("AntiAdvBot","Do not post URLs!") -- send a message
    user:Disconnect() -- and disconnect
    return 1 -- block the chat message
  end
end


well this are 2 diff codes wich i have used for 2 diff scripts and nothin is happenin mannn i m usin ptokax 0.4.0.0 the latest one no error nothing but i don get output mannn can ne one tell me y
Title: Re: pls help meee
Post by: PPK on 27 April, 2008, 12:42:08
You using examples that are for old PtokaX versions and not working on 0.4.0.0. Check scripting.docs folder that is in package with PtokaX.

For 0.4.0.0 that code will looks like..
function UserConnected(user)
Core.SendToUser(user, "<Welcome-Bot> Welcome! Have a good time!")
end


function ChatArrival(user, data)
  data=string.sub(data,1,string.len(data)-1) -- remove end pipe
  if string.find(data,"https?://") or string.find(data,"www%.") then -- if this string is found then
    Core.SendToUser(user, "<AntiAdvBot> Do not post URLs!") -- send a message
    Core.Disconnect(user) -- and disconnect
    return true -- block the chat message
  end
end
Title: Re: pls help meee
Post by: bastya_elvtars on 27 April, 2008, 13:09:27
This is a heads-up that the wiki badly needs updating. :-/
Title: Re: pls help meee
Post by: satya on 28 April, 2008, 09:00:19

well thanks for dat but i copied the script wich u said dat is for the ptokax 0.4.0.0 but still its not working mann


well can u tell me a site or nething wich can help me to learn the scripting. and also is there ne software just like the C compiler where we write the codes n execute it, for tryin this scriptsss
Title: Re: pls help meee
Post by: bastya_elvtars on 28 April, 2008, 19:54:17
For trying the scripts, you can run the Lua executable (http://luabinaries.luaforge.net/). The scripting documentation and the Lua manual can help you. You don't have to start with PtokaX, I recommend generic Lua first.