Author Topic: error in module Ptokax exe  (Read 3867 times)

0 Members and 1 Guest are viewing this topic.

Offline Tarot

  • Forum Ace
  • *****
  • Posts: 92
  • Karma: +1/-0
error in module Ptokax exe
« on: 15 March, 2004, 19:47:00 »
Exception EZerodivide in module Ptokax exe at 000723c8 Floating point division by zero

what can i do whit this error.

run the hub on a server.
----Server info----
proliant ml330 G2
mhz = "1,5ghz PIII" Intel Xeon
HD = 3 x 78 gig
ram = "512 mb 133 DDR ram"
connection = "8192/1024
os = "Windows 2003 server"
Gothic Metal City
       

photoshop and 3D



PtokaX forum

error in module Ptokax exe
« on: 15 March, 2004, 19:47:00 »

Offline Skrollster

  • Lord
  • ***
  • Posts: 293
  • Karma: +3/-0
(No subject)
« Reply #1 on: 15 March, 2004, 19:56:04 »
it is just as it says..

you try to devide something with 0 somewhere in your script...

 xx/0 will crash the hubsoft..

Offline Tarot

  • Forum Ace
  • *****
  • Posts: 92
  • Karma: +1/-0
(No subject)
« Reply #2 on: 15 March, 2004, 20:07:12 »
the hub runs on Channel Bot v5.0 SX
--// Phrase-O-Rama Script
--// By Chaggydawg
--// Version 0.3b
i think it = Phrase-O-rama
i have no cnowledge of scripting
« Last Edit: 15 March, 2004, 20:13:16 by Tarot »
Gothic Metal City
       

photoshop and 3D



Offline Skrollster

  • Lord
  • ***
  • Posts: 293
  • Karma: +3/-0
(No subject)
« Reply #3 on: 15 March, 2004, 20:33:23 »
I have no knowlage about any of these scripts.. sorry

Offline Tarot

  • Forum Ace
  • *****
  • Posts: 92
  • Karma: +1/-0
(No subject)
« Reply #4 on: 15 March, 2004, 21:01:11 »
is oke
 i have take the  Phrase-O-Rama Script  out the hubsoft  now whating
Skrollster
Gothic Metal City
       

photoshop and 3D



Offline Shaggie

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
(No subject)
« Reply #5 on: 03 January, 2005, 14:24:33 »
plz... can you FIX this scripts

 
Exception EZerodivide in module Ptokax exe at 000723c8 Floating point division by zero
 

Code: [Select]
--// Phrase-O-Rama Script
--// By Chaggydawg
--// Version 0.3b
« Last Edit: 03 January, 2005, 20:37:07 by Shaggie »

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 744
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
(No subject)
« Reply #6 on: 03 January, 2005, 19:20:12 »
there is a function donewphrase()

replace the whole function to this:

Code: [Select]
function donewphrase()
repeat
doreadphrases()
answer = phrases[random(1,getn(phrases))]
startingphrase = 1
remainscore = random(1,3)
f = strlen(answer)
until f~=0
if f~=0 then
timer = 120 / f * 1000
SetTimer(timer)
return answer,startingphrase
end
end
Everything could have been anything else and it would have just as much meaning.

Offline Shaggie

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
(No subject)
« Reply #7 on: 03 January, 2005, 20:35:34 »
Thanks you very much!!! However, I cannot say, whether it really works.

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 744
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
(No subject)
« Reply #8 on: 03 January, 2005, 22:11:03 »
Quote
Originally posted by Shaggie
Thanks you very much!!! However, I cannot say, whether it really works.

if the game works, then there wont be such errors any longer. i embedded a protection against division by zero.
Everything could have been anything else and it would have just as much meaning.

Offline Shaggie

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
(No subject)
« Reply #9 on: 04 January, 2005, 00:41:07 »
Hi bastya_elvtars,

It seems the floating error is gone, but now there is another problem.
When the game is stopped, a few seconds later, he gives the next message without the answer.
And a random user gets the points :-P
 
 
[00:03:03] DmC Got It!! The Answer Was: ?
[00:03:03] DmC has been awarded 5 points!!
[00:03:03] [54] DmC - 5

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 744
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
(No subject)
« Reply #10 on: 04 January, 2005, 00:49:58 »
Secured it more.

BTW this code is extremely dirty. Will rewrite it.

Code: [Select]
--// Phrase-O-Rama Script
--// By Chaggydawg
--// Version 0.3b




phrases = {}
phraselists = {
"Common Phrases",
"On The Map",
"US Presidents",
"McDonalds Menu",
"Periodic Table",
"Top 100 Movies",
"Top 100 Video Games",
"Billboard Top 100 Of The 80s",
"Billboard Top 100 Of The 90s",
"TV Shows",
"Current Top 100 Scifi-Fantasy Books",
"1997-2000 Licensed Anime",
"Expanded Star Wars",
}
topscores = {}
timer = 5000
BotName = "Phrase-O-Rama"
answer = ""
remainscore = 0
gameon = "off"
phrasenumbers = {}
startingphrase = 1


function Main()
SetTimer(timer)
doreadscores()
doreadphrases()
donewphrase()
if gameon == "on" then StartTimer() end
end


function DataArrival(curUser, Data)
s,e,cmd = strfind(Data,"%b<>%s(%S+)")
s,e,scored = strfind(Data,"%b<>%s%S+%s+(%d+)")
s,e,mess = strfind(Data, "%b<>%s+(.*)")
if cmd == "+startgame|" then
dostartgame(curUser)
elseif cmd == "+stopgame|" then
dostopgame(curUser)
elseif cmd == "+scores|" then
displayscores(curUser)
elseif cmd == "+porhelp|" then
dohelp(curUser)
elseif cmd =="+skip|" then
doskipphrase(curUser)
return 1
elseif cmd == "+myscore|" then
domyscore(curUser)
end
---------
if mess ~= nil and answer ~= " " then
mess = gsub(mess,"%A","")
ants = gsub(answer,"%A","")
if strfind(strlower(mess),strlower(ants)) ~= nil then
addtoscore(curUser,remainscore)
answer, startingphrase = donewphrase()
end
end
end


function OnTimer()
doreveal()
end


function donewphrase()
doreadphrases()
answer = phrases[random(1,getn(phrases))]
startingphrase = 1
remainscore = random(1,3)
f = strlen(answer)
timer = 120 / f * 1000
SetTimer(timer)
return answer,startingphrase
end


function doreveal()
if startingphrase == 1 then testing = gsub(answer,"%a","?"); startingphrase = 0; SendToAll(BotName,"This Phrase will be worth "..remainscore.." per unrevealed letter plus 5 points for solution."); end
t,p = gsub(testing,"?","")
if p < 2 then
SendToAll(BotName,"The Answer Was: "..answer)
donewphrase()
else
curnumber = burp()
testing = strsub(testing,1,curnumber-1)..strsub(answer,curnumber,curnumber)..strsub(testing,curnumber+1,strlen(testing))
SendToAll(BotName,"[Category: "..phrasename.."]   "..testing)
end
end


function burp()
curnumber = random(1,strlen(answer))
if strsub(testing,curnumber,curnumber) ~= "?" then burp() end
return curnumber
end




function dostartgame(curUser)
if gameon == "off" then
gameon = "on"
donewphrase()
StartTimer()
SendToAll(BotName, curUser.sName.." Has Started a new Game of Phrase-O-Rama!")
end
end


function dostopgame(curUser)
if gameon == "on" then
gameon = "off"
SendToAll(BotName, curUser.sName.." Has Ended the Phrase-O-Rama Game :(")
SendToAll(BotName,"The Answer Was: "..answer)
StopTimer()
answer = " "
remainscore = 0
dowritescores()
end
end


function displayscores(curUser)
curUser:SendData(BotName,"-----------------------------------------------")
curUser:SendData(BotName,"Top 10 Phrase-O-Rama Player")
curUser:SendData(BotName,"-----------------------------------------------")
sort(topscores, function(a,b) return a[1]>b[1] end)
total = 10
if getn(topscores) < total then total = getn(topscores) end
for i = 1,total,1 do
curUser:SendData(BotName,"["..i.."] "..topscores[i][2].." - "..topscores[i][1])
end
curUser:SendData(BotName,"-----------------------------------------------")
end


function addtoscore(curUser,remainscore)
dude = getn(topscores)+1
oldscore = 0
for i = 1,getn(topscores),1 do
if topscores[i][2] == curUser.sName then
dude = i
oldscore = topscores[i][1]
break
end
end
a,b = gsub(testing,"?",".")
topscores[dude] = {(b*remainscore)+oldscore+5,curUser.sName}
dowritescores()
sort(topscores, function(a,b) return a[1]>b[1] end)
for i = 1,getn(topscores),1 do
if topscores[i][2] == curUser.sName then
SendToAll(BotName,curUser.sName.." Got It!! The Answer Was: "..answer)
SendToAll(BotName,curUser.sName.." has been awarded "..((b*remainscore)+5).." points!")
SendToAll(BotName,"["..i.."] "..topscores[i][2].." - "..topscores[i][1])
end
end
end


function dowritescores()
writeto("por/porscores.txt","w")
write("1&"..topscores[1][2].."$"..topscores[1][1])
writeto()
for i = 2,getn(topscores),1 do
appendto("por/porscores.txt")
write("\n"..(i).."&"..topscores[i][2].."$"..topscores[i][1])
writeto()
end
end


function doreadscores()
readfrom("por/porscores.txt")
A=1
while 1 do
line = read()
if line == nil then break end
s,e,rank,unick,score = strfind(line,"(%S+)&(%S+)$(%S+)")
topscores[tonumber(A)] = {tonumber(score),unick}
A = A+1
end
A = nil
end


function doreadphrases()
phrases = {}
phrasename = phraselists[random(1,getn(phraselists))]
readfrom("por/"..strlower(phrasename)..".txt")
while 1 do
line = read()
if line == nil then break end
if line~="" then
tinsert(phrases,line)
end
end
end


function dohelp(curUser)
curUser:SendData(BotName, "Phrase-O-Rama Help")
curUser:SendData(BotName, "+startgame Begins Phrase-O-Rama Game")
curUser:SendData(BotName, "+stopgame Stops Phrase-O-Rama Game")
curUser:SendData(BotName, "+scores Displays Top 10 Phrase-O-Rama Scores")
curUser:SendData(BotName, "+myscore Displays your Phrase-O-Rama Rank/Score")
curUser:SendData(BotName, "+porhelp Displays Phrase-O-Rama Help")
if curUser.bOperator then
curUser:SendData(BotName, "+skip Skips the Current Phrase")
end
end


function domyscore(curUser)
sort(topscores, function(a,b) return a[1]>b[1] end)
for i = 1,getn(topscores),1 do
if topscores[i][2] == curUser.sName then
curUser:SendData(BotName,"Rank ["..i.."] "..topscores[i][2].." - "..topscores[i][1])
break
end
end
end


function doskipphrase(curUser)
if curUser.bOperator then
SendToAll(BotName,curUser.sName.." has Skipped this phrase.")
SendToAll(BotName,"No Points Awarded This Round.")
SendToAll(BotName,"The Answer was: "..answer)
donewphrase()
end
end


Everything could have been anything else and it would have just as much meaning.

Offline Shaggie

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
(No subject)
« Reply #11 on: 04 January, 2005, 01:05:34 »
Thanks again bastya_elvtars


It would be nice indeed if you could rewrite the script, it's a nice game.

Offline bastya_elvtars

  • Forum God
  • ****
  • Posts: 3 744
  • Karma: +173/-7
  • The rock n' roll doctor
    • The FreshStuff3 Site
(No subject)
« Reply #12 on: 04 January, 2005, 01:17:22 »
cannot test atm :(

btw is it working now?
Everything could have been anything else and it would have just as much meaning.

Offline Shaggie

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
(No subject)
« Reply #13 on: 04 January, 2005, 01:36:48 »
Hi bastya_elvtars

Yes, it now works :-)

Thanks again

PtokaX forum

(No subject)
« Reply #13 on: 04 January, 2005, 01:36:48 »