My BIG PROBLEM
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

My BIG PROBLEM

Started by pHaTTy, 03 January, 2004, 20:32:48

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

pHaTTy

Damn im gonna go kill myself LOL please someone help me fix this or even just fix it and ill be happy, i have alot of plans ahead for it, but i cant fix a major bug, and its pizzed me off so i quit


please help

--[Magic]
--v0.71 [Magic] Written by Phatty
--Catagory[Games]


LogedIn = {}
points = {}

erasepoints = 3
Fuxion = "timebased"

function Main()
	SendA = SendToAll
	Bot = "[Magic]"
	frmHub:RegBot(Bot)
	DrainFusion()
	dVersion = "v0.71"
end

function DrainFusion()
	local number = random(5)
	if number == 1 then
		SendA(Bot,"Scripts have been rebooted")
	elseif number == 2 then
		SendA(Bot,"Warning scripts restarted")
	elseif number == 3 then
		SendA(Bot,"It's all [Magic] when scripts restart")
	elseif number == 4 then
		SendA(Bot,"Why do these scripts keep restarting")
	elseif number == 5 then
		SendA(Bot,"Will you stop restarting scripts :P")
	end
end

function FusionStart(level)
	if Fuxion == "timebased" then
		FusionStartb(level)
		return 1
	else
		SetTimer(1*65432)
		if level == "1" then
			difficulty = "easy"
			ticker = random(3)
		elseif level == "2" then
			difficulty = "mediam"
			ticker = random(10)
		elseif level == "3" then
			difficulty = "hard"
			ticker = random(20)
		elseif level == "4" then
			difficulty = "unstopable"
			ticker = random(60)
		--else
			--difficulty = "random"
			--nr = random(4)
			--level = nr
			--StartBot(level)
		end
		SendA(Bot,"[Magic] is set to "..difficulty)
		Find(ticker)
	end
end

function FusionStartb(level)
	if level == "1" then
		difficulty = "easy"
		ticker = random(3)
		SetTimer(1*30000)
	elseif level == "2" then
		difficulty = "mediam"
		ticker = random(10)
		SetTimer(1*35000)
	elseif level == "3" then
		difficulty = "hard"
		ticker = random(20)
		SetTimer(1*60000)
	elseif level == "4" then
		difficulty = "unstopable"
		ticker = random(60)
		SetTimer(1*60000)
	--else
		--difficulty = "random"
		--nr = random(4)
		--level = nr
		--StartBot(level)
	end
	SendA(Bot,"[Magic] is set to "..difficulty)
	Find(ticker)
end

function Find(ticker)
	number = random(600)
	--SendA(Bot,number.." x "..ticker)
	killer = random(4)
	Translate(killer)
end

function Translate(killer)
	if killer == 1 then
		barbossa = number + ticker
		SendA(Bot,"Add together "..number.." and "..ticker)
	elseif killer == 2 then
		barbossa = number - ticker
		SendA(Bot,"Subtract "..number.." from "..ticker)
	elseif killer == 3 then
		barbossa = number / ticker
		SendA(Bot,"Divide "..number.." by "..ticker)
	elseif killer == 4 then
		barbossa = number * ticker
		SendA(Bot,"Multiply "..number.." by "..ticker)
	else
		--On Error resume next
		barbossa = 1
	end
	SendA(Bot,"Answer = "..barbossa)
	StartTimer()	
end

function OnTimer()
	local number = random(5)
	if number == 1 then
		SendA(Bot,"***Failed to input correct answer")
	elseif number == 2 then
		SendA(Bot,"***No one was clever to get that answer")
	elseif number == 3 then
		SendA(Bot,"***You all are useless morons")
	elseif number == 4 then
		SendA(Bot,"***You bunch of MUPPETS!!!")
	elseif number == 5 then
		SendA(Bot,"***Useless sods")
	end
	StopTimer()
	FusionStart(level)
end

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 == "m.start" then
			if LogedIn[user.sName] == nil then
				SendA(Bot,"you must be first logged in")
				return 1
			else
				s,e,cmd,level = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
				if level == nil then
					SendA(Bot,"remember to select a level m.start ")
					return 1
				else
					SendA(Bot,"[Magic] has been started")
					FusionStart(level)
					return 1
				end
			end
		elseif cmd == "m.login" then
			if LogedIn[user.sName] == 1 then
				user:SendData(Bot,"You can't log in twice :P")
				return 1
			else
				user:SendData(Bot,"You have succesfully logged into [Magic]")
				LogedIn[user.sName] = 1
				points[user.sName] = 0
				return 1
			end
		elseif cmd == "m.score" then
			user:SendData(Bot,points[user.sName])
			return 1
		elseif cmd == "m.version" then
			SendA("---------====================================================================------")
			SendA(Bot,"../// This Hub is running [Magic] "..dVersion.." written and released by Phatty\\\..")
			SendA("---------====================================================================------")
			return 1
		elseif cmd == "a" then
			s,e,answer = strfind(data,"%b<>%s+(%S+)")
			local theanswer = barbossa
			if LogedIn[user.sName] == 1 then
				if answer == theanswer then
					SendA(Bot,"***"..user.sName.." scores "..ticker.." point(s)")
					if points[user.sName] == nil or points[user.sName] == 0 then
						points[user.sName] = ticker
					else
						points[user.sName] = points[user.sName] + ticker
					end
					StopTimer()
					FusionStart(level)
				else
					SendA(Bot,"Incorrect")
					if points[user.sName] < erasepoints then
						user:SendPM(Bot,"You have zero score so i cant take points away from u, so i will disconnect you instead :P")
						user:Disconnect()
					else
						points[user.sName] = points[user.sName] - erasepoints
					end
				end
			else
				user:SendData(Bot,"Please login first, type m.help")
				return 1
			end
		end
	end
end


problem is the answer in the cmd == "a" blablah

thanx,

-phatty :)
Resistance is futile!

plop

s,e,answer = strfind(data,"%b<>%s+(%S+)")
here you get cmd again and not the answer.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

Still does not work m8 :((

i even have the debug answer so i can check but still doesnt :(
Resistance is futile!

Intel

Seems To BE a Big PRoblem, When we have a problem we run 2 you guys, and now u have a probelm whom shall u run too ???
I better Start learn this programing thing to help out...give me a tip where to start !
Punnakku

pHaTTy

QuoteOriginally posted by Intel
Seems To BE a Big PRoblem, When we have a problem we run 2 you guys, and now u have a probelm whom shall u run too ???
I better Start learn this programing thing to help out...give me a tip where to start !

Goto my how to's ;)

i have no one i can run to atm i hope can run to peeps like Plop or Opium or Optimus, skrollster and many other greats scripters :))

he he he :))
Resistance is futile!

c h i l l a

#5
QuoteOriginally posted by plop
s,e,answer = strfind(data,"%b<>%s+(%S+)")
here you get cmd again and not the answer.

plop

dunno, but I guess you want the second word

s,e,answer = strfind(data,"%b<>%s+%S+%s+(%a+)$")

pHaTTy

nope still not :(( it still disconnects me even if the answer is correct
Resistance is futile!

Intel

then make a error their where it disconnects, then it will just ignore it and go on...hehehe
Punnakku

pHaTTy

no it wont because it will give ppl points for no reason, wether answer is correct or incorrect......
Resistance is futile!

c h i l l a

okey okey...  so  do this


local s,e,answer = strfind(data,"%b<>%s+%S+%s+(%S+)")


and this

 


tonumber(answer) == barbossa then

no need to extra create a variable I think

raz

can i just say i tried dis script out and its dodgy. when i do m.start to start the game it starts up properly. the thing wrong is that the question come on and wid it comes a anwser. maybe thats the problem u need 2 add a timer in 4 da anwser 2 come after 5 minz or something. lol cuz dere is no question thats y u might be getting disconnected.lol  :D

raz

phatty safe wat u up 2? have u solved the problem yet.lol  :D

pHaTTy

nope :S but i give up anyhow, i made a new gamebot much better, ;)
Resistance is futile!

raz

lol which 1 is dat. anyway if u give up wat we supposed 2 do. lol  :D

pHaTTy

QuoteOriginally posted by raz
lol which 1 is dat. anyway if u give up wat we supposed 2 do. lol  :D

dunno lol, use the rest of the source or maybe somecan can solve problem and make a gamebot out of it, either way good luck ;)
Resistance is futile!

SMF spam blocked by CleanTalk