how to enable simple script on ptokax?

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
gambazoolu
Posts: 5
Joined: 2006-12-11 16:38

how to enable simple script on ptokax?

Post by gambazoolu » 2006-12-12 19:21

Hello!


i was trying to enable a simple script i found on the net:

Code: Select all

--Calculator by Phatty
--v1.21
--Added Invalid usage message
--useage: sum <nr> <by> <nr> = example : sum 1 + 1


Bot = "Calculator"

function DataArrival(user,data)
	if strsub(data, 1, 1) == "<" then
		data=strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data,"%b<>%s+(%S+)")

		if cmd == "sum" then
			s,e,cmd,nr1,what,nr2 = strfind(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)")

			if nr2  == nil then
				user:SendData(Bot, "Not a valid usage please try again ;)")
				return 1
			else
				if what == "+" then
					sum = nr1 + nr2
				elseif what == "-" then
					sum = nr1 - nr2
				elseif what == "x" then
					sum = nr1 * nr2
				elseif what == "/" then
					sum = nr1 / nr2
				end
				user:SendData(Bot,"The sum: "..nr1..what..nr2.." = "..sum)
			return 1
			end
		end
	end
end
but it's not working... i chose enable scripts, and made sure that there are no syntax problems... and checked the box next to the script name....
why doesn't it work?
can you give me a simple script that WORKS for you so i can check if it's even possible to run scripts on my hub?

thank you!

gambazoolu
Posts: 5
Joined: 2006-12-11 16:38

Post by gambazoolu » 2006-12-12 19:25

By the way, this script works:
Bot = "MyBot"

function Main()
frmHub:RegBot(Bot)
end
it creates a bot!
why other scripts don't work?? :-(

Pothead
Posts: 223
Joined: 2005-01-15 06:55

Post by Pothead » 2006-12-13 13:05

That's an lua 4 script. It'll need updating. You are best asking at the ptokax lua forum. :)

gambazoolu
Posts: 5
Joined: 2006-12-11 16:38

Post by gambazoolu » 2006-12-13 13:35

Pothead wrote:That's an lua 4 script. It'll need updating. You are best asking at the ptokax lua forum. :)
googling " ptokax lua forum" i found a few forums... non of them seem busy... actually, they look deserted... can you give me a link to the forum you meant?

thanks!!

Ketsuron
Posts: 13
Joined: 2004-03-25 23:39

Post by Ketsuron » 2006-12-13 15:19


Locked