PtokaX forum

Development Section => Your Developing Problems => Topic started by: pHaTTy on 03 January, 2004, 20:32:48

Title: My BIG PROBLEM
Post by: pHaTTy on 03 January, 2004, 20:32:48
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 :)
Title:
Post by: plop on 03 January, 2004, 20:48:56
s,e,answer = strfind(data,"%b<>%s+(%S+)")
here you get cmd again and not the answer.

plop
Title:
Post by: pHaTTy on 03 January, 2004, 21:01:56
Still does not work m8 :((

i even have the debug answer so i can check but still doesnt :(
Title:
Post by: Intel on 03 January, 2004, 21:59:40
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 !
Title:
Post by: pHaTTy on 03 January, 2004, 22:18:40
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 :))
Title:
Post by: c h i l l a on 04 January, 2004, 11:36:13
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+)$")
Title:
Post by: pHaTTy on 05 January, 2004, 12:05:20
nope still not :(( it still disconnects me even if the answer is correct
Title:
Post by: Intel on 05 January, 2004, 14:15:19
then make a error their where it disconnects, then it will just ignore it and go on...hehehe
Title:
Post by: pHaTTy on 05 January, 2004, 14:30:54
no it wont because it will give ppl points for no reason, wether answer is correct or incorrect......
Title:
Post by: c h i l l a on 05 January, 2004, 16:21:26
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
Title:
Post by: raz on 13 January, 2004, 18:00:51
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
Title:
Post by: raz on 15 January, 2004, 17:04:11
phatty safe wat u up 2? have u solved the problem yet.lol  :D
Title:
Post by: pHaTTy on 15 January, 2004, 17:08:52
nope :S but i give up anyhow, i made a new gamebot much better, ;)
Title:
Post by: raz on 15 January, 2004, 17:10:24
lol which 1 is dat. anyway if u give up wat we supposed 2 do. lol  :D
Title:
Post by: pHaTTy on 15 January, 2004, 17:11:52
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 ;)