error in module Ptokax exe
 

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

error in module Ptokax exe

Started by Tarot, 15 March, 2004, 19:47:00

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tarot

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



Skrollster

it is just as it says..

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

 xx/0 will crash the hubsoft..

Tarot

#2
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
Gothic Metal City
       

photoshop and 3D



Skrollster

I have no knowlage about any of these scripts.. sorry

Tarot

is oke
 i have take the  Phrase-O-Rama Script  out the hubsoft  now whating
Skrollster
Gothic Metal City
       

photoshop and 3D



Shaggie

#5
plz... can you FIX this scripts

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

--// Phrase-O-Rama Script
--// By Chaggydawg
--// Version 0.3b

bastya_elvtars

there is a function donewphrase()

replace the whole function to this:

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.

Shaggie

Thanks you very much!!! However, I cannot say, whether it really works.

bastya_elvtars

QuoteOriginally 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.

Shaggie

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

bastya_elvtars

Secured it more.

BTW this code is extremely dirty. Will rewrite it.

--// 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.

Shaggie

Thanks again bastya_elvtars


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

bastya_elvtars

cannot test atm :(

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

Shaggie

Hi bastya_elvtars

Yes, it now works :-)

Thanks again

SMF spam blocked by CleanTalk