Issue842

Title Freedroid freezing after a bet
Priority 0.16 rc bugs Status resolved
Assigned To greg Keywords
Linked issues Watchers greg

Submitted on 2015-10-21 20h05 by sydneyjd, last changed by matthiaskrgr.

Messages
Author: sydneyjd Date: 2015-10-21   20h05
Hello all, so i was making a bet wit the bartender, and the game freezes
sometimes. It seems to be pretty reproducable. Here is the output.
http://paste.debian.net/317358/
Thanks!
Author: sydneyjd Date: 2015-10-24   16h35
my pastebin expired, i will get another one.
Author: sydneyjd Date: 2015-10-24   16h39
Ok, odd, i cannot seem to reproduce it now...
Author: sydneyjd Date: 2015-10-24   16h45
Its seem to be whenever the barkeeper says "here is part of your bet back".

New map label added: label_name=60from59house, pos.x=6, pos.y=6, pos.z=60
New map label added: label_name=69to31, pos.x=11, pos.y=16, pos.z=69
New map label added: label_name=69from31, pos.x=11, pos.y=15, pos.z=69
New map label added: label_name=24-exit-level-70, pos.x=98, pos.y=1, pos.z=70
New map label added: label_name=72to16, pos.x=31, pos.y=52, pos.z=72
New map label added: label_name=72from16, pos.x=34, pos.y=52, pos.z=72ALSA lib
pcm.c:7905:(snd_pcm_recover) underrun occurred

---------------------------------------------------------------------------------
FreedroidRPG 0.16rc2-14-g3281067_mod encountered a problem in function:
resume_lua_coroutine
Error running Lua code: /usr/local/share/freedroidrpg/dialogs/Ewald.lua:599: bad
argument #1 to 'add_gold' (number has no integer representation).
Erroneous LuaCode={
534  		code = function()
535  			local function flip_coin()
536  				result = math.random(0, 1)
537  				Npc:says(_"%s.", coin_str[result + 1]:gsub("%a", string.upper, 1))
538  				return result
539  			end
540  
541  			Npc:says(_"The last four coin flips:")
542  			ewd2, ewd3, ewd4 = flip_coin(), flip_coin(), flip_coin()
543  			Tux:says(_"Last flip. I hope it is the one I want!")
544  			ewd5 = flip_coin()
545  
546  			ewald_sum = ewd1 + ewd2 + ewd3 + ewd4 + ewd5
547  			Npc:says(_"Looks like that is %d tails, and %d heads.", ewald_sum, 5 -
ewald_sum)
548  
549  			local win = 0 -- find if tux won...
550  			if (ewald_sum > 2) then
551  				Npc:says(_"Tails won...")
552  				win = 0.5 * tux1
553  			else
554  				Npc:says(_"Heads won...")
555  				win = 0.5 * (1 - tux1)
556  			end
557  
558  			if (math.fmod(ewald_sum, 2) == tux1) then
559  				Npc:says(_"...and there were an odd number of %s.", coin_str[tux1 + 1])
560  				win = win + 0.5 * tux2
561  			else
562  				Npc:says(_"...and there were an even number of %s.", coin_str[tux1 + 1])
563  				win = win + 0.5 * (1 - tux2)
564  			end
565  
566  			if (win == 1) then -- WIN
567  				Npc:says_random(_"Looks like another winning combination! Good job!",
568  								_"You have the best luck! You won!",
569  								_"Too many of these and I'll go out of business. You won!",
570  								_"You will have to tell me how you did it. You Won!",
571  								_"Let me be even with you: I can't make heads or tails of how you
won this odd game. Good Job!")
572  				display_console_message(string.format(_"You won %d valuable circuits in
the coin-flip game with Ewald.", bet))
573  			elseif (win == 0) then --LOSS
574  				Npc:says_random(_"Looks like you got everything wrong... here is some
of your bet back.",
575  								_"Well, close, but exactly wrong. Here is some of your bet back.",
576  								_"You need to do exactly opposite of what you did here. Here is
part of your bet back.",
577  								_"Close, but no cigar. Here is some of your money back.",
578  								_"Next time pick the opposite of what you did this time... or
something.",
579  								_"Close only counts in hand grenades and horseshoes. But some money
back.")
580  
581  				local bet_loss = {easy = 1, normal = 0.75, hard = 0.5} -- easy: 100%
back normal: 75% back, hard: 50% back
582  				bet = bet*bet_loss[difficulty()]
583  
584  				display_console_message(string.format(_"You lost %d valuable circuits
in the coin-flip game with Ewald.", math.floor(bet)))
585  			elseif (win == 0.5) then -- COMPLETE LOSS (0% back)
586  				Npc:says_random(_"You lost. You were half right, but half wrong. Pick
one and stay with it.",
587  								_"You lost. You were all messed up. Better luck next time.",
588  								_"You lost. Maybe you should try something else for a while?",
589  								_"You lost.",
590  								_"You lost. You might try the dice game next time.")
591  				bet = -bet
592  
593  				display_console_message(string.format(_"You lost %d valuable circuits
in the coin-flip game with Ewald.", bet))
594  			else -- ERROR:
595  				Npc:says(_"THIS IS AN ERROR! REPORT IT PLEASE! E-MAIL:
freedroid-discussion@lists.sourceforge.net")
596  			end
597  
598  			if (not running_benchmark()) then -- dialog validator reports errors
here sometimes when "bet" > gold we have
>599 				Tux:add_gold(bet)
600  			end
601  
602  			total_bet = total_bet + bet
603  
604  			next("node60")
605  		end,
}


If you encounter this message, please inform the FreedroidRPG developers about it!
You can
  send an e-mail to                    freedroid-discussion AT lists.sourceforge.net
  mention it on our IRC channel        #freedroid on irc.freenode.net
  or report the bug on our tracker at  http://bugs.freedroid.org/

Thank you!
---------------------------------------------------------------------------------

---------------------------------------------------------------------------------
Termination of freedroidRPG initiated... Thank you for playing freedroidRPG.
Author: matthiaskrgr Date: 2015-10-31   17h45
Fixed via  c3f81ec3752e783758577e5b8186e664607ebbfa . Thanks
History
Date User Action Args
2015-10-31 17:45:59matthiaskrgrsetstatus: open -> resolved
assignedto: greg
messages: + msg3268
nosy: + greg
2015-10-24 16:45:58sydneyjdsetmessages: + msg3265
2015-10-24 16:39:59sydneyjdsetmessages: + msg3264
2015-10-24 16:35:08sydneyjdsetmessages: + msg3263
2015-10-23 02:00:07sydneyjdsetpriority: bug -> 0.16 rc bugs
2015-10-21 20:05:13sydneyjdcreate