Game "Not Responding"

SquirrelUK
28 Apr 2011, 18:08
I'm in the middle of writing a game, but once I run it and start playing, before not very long the Quest game screen goes into "Not Responding" mode. Can anyone help? The ASL code is below:



' "Cast your vote!"
' Created with QDK 4.1.4

!include <stdverbs.lib>

define game <Cast your vote!>
asl-version <410>
start <Cast your vote!>
game info <Created with QDK 4.1.4>
end define

define options
debug on
panes on
abbreviations on
end define

define room <Cast your vote!>
script {
set numeric <comtot; 0>
set numeric <socTOT; 0>
set numeric <libTOT; 0>
set numeric <refTOT; 0>
set numeric <conTOT; 0>
set numeric <natTOT; 0>
set numeric <youTOT; 0>
set numeric <comCAL; 14>
set numeric <socCAL; 15>
set numeric <libCAL; 14>
set numeric <refCAL; 14>
set numeric <conCAL; 15>
set numeric <natCAL; 14>
set numeric <youCAL; 14>
set numeric <turnpoints; 0>
msg <Welcome to |bCast your vote! |xb>
wait <Press any key to continue.>
do <Points Allocation Proposal>
}
end define

define procedure <Points Allocation Proposal>
set numeric <compap; 0>
set numeric <socPAP; 0>
set numeric <libPAP; 0>
set numeric <refPAP; 0>
set numeric <conPAP; 0>
set numeric <natPAP; 0>
set numeric <youPAP; 0>
inc <comTOT; %comCAL%>
inc <socTOT; %socCAL%>
inc <libTOT; %libCAL%>
inc <refTOT; %refCAL%>
inc <conTOT; %conCAL%>
inc <natTOT; %natCAL%>
inc <youTOT; %youCAL%>
do <Points Allocation Proposal 2>
end define

define procedure <Points Allocation Proposal 2>
if ( %turnpoints% <= 99 ) then set numeric <random number; $rand (1; 7)$> else {
set numeric <turnpoints; 0>
set numeric <random number; 0>
msg <The following points allocation has been proposed. The current allocation and the running totals are listed in brackets.|n|nCommunist Party - %comPAP% (%comCAL%) (%comTOT%)|nSocialist Party - %socPAP% (%socCAL%) (%socTOT%)|nLiberal Party - %libPAP% (%libCAL%) (%libTOT%)|nReform Party - %refPAP% (%refCAL%) (%refTOT%)|nConservative Party - %conPAP% (%conCAL%) (%conTOT%)|nNationalist Party - %natPAP% (%natCAL%) (%natTOT%)|n|nYou - %youPAP% (%youCAL%) (%youTOT%)>
do <Voting> }
if ( %random number% = 1 ) then {
inc <compap; 1>
inc <turnpoints; 1>
do <Points Allocation Proposal 2> }
if ( %random number% = 2 ) then {
inc <socpap; 1>
inc <turnpoints; 1>
do <Points Allocation Proposal 2> }
if ( %random number% = 3 ) then {
inc <libpap; 1>
inc <turnpoints; 1>
do <Points Allocation Proposal 2> }
if ( %random number% = 4 ) then {
inc <refpap; 1>
inc <turnpoints; 1>
do <Points Allocation Proposal 2> }
if ( %random number% = 5 ) then {
inc <conpap; 1>
inc <turnpoints; 1>
do <Points Allocation Proposal 2> }
if ( %random number% = 6 ) then {
inc <natpap; 1>
inc <turnpoints; 1>
do <Points Allocation Proposal 2> }
if ( %random number% = 7 ) then {
inc <youpap; 1>
inc <turnpoints; 1>
do <Points Allocation Proposal 2> }
end define

define procedure <Voting>
set numeric <yesvote; 0>
set numeric <novote; 0>
set string <comvote; abstain>
set string <socvote; abstain>
set string <libvote; abstain>
set string <refvote; abstain>
set string <convote; abstain>
set string <natvote; abstain>
set string <youvote; abstain>
msg <Press "y" in order to vote yes to the proposal, or press any other key in order to vote no to it.>
enter <yourvotechoice>
if ( #yourvotechoice# = y ) then {
set string <youvote; yes>
inc <yesvote; %youtot%> } else {
set string <youvote; no>
inc <novote; %youtot%> }
if ( (%compap% * 3) + %socpap% > (%comcal% * 3) + %soccal% ) then {
set string <comvote; yes>
inc <yesvote; %comtot%> } else {
set string <comvote; no>
inc <novote; %comtot%> }
if ( (%socpap% * 3) + %compap% + %libpap% > (%soccal% * 3) + %comcal% + %libcal% ) then {
set string <socvote; yes>
inc <yesvote; %soctot%> } else {
set string <socvote; no>
inc <novote; %soctot%> }
if ( (%libpap% * 3) + %socpap% + %refpap% > (%libcal% * 3) + %soccal% + %refcal% ) then {
set string <libvote; yes>
inc <yesvote; %libtot%> } else {
set string <libvote; no>
inc <novote; %libtot%> }
if ( (%refpap% * 3) + %libpap% + %conpap% > (%refcal% * 3) + %libcal% + %concal% ) then {
set string <refvote; yes>
inc <yesvote; %reftot%> } else {
set string <refvote; no>
inc <novote; %reftot%> }
if ( (%conpap% * 3) + %refpap% + %natpap% > (%concal% * 3) + %refcal% + %natcal% ) then {
set string <convote; yes>
inc <yesvote; %contot%> } else {
set string <convote; no>
inc <novote; %contot%> }
if ( (%natpap% * 3) + %conpap% > (%natcal% * 3) + %concal% ) then {
set string <natvote; yes>
inc <yesvote; %nattot%> } else {
set string <natvote; no>
inc <novote; %nattot%> }
if ( %yesvote% > %novote% ) then {
msg <The parties have voted for the proposal by %yesvote% to %novote%. The parties voted as follows:|n|nCommunist Party - #comvote#|nSocialist Party - #socvote#|nLiberal Party - #libvote#|nReform Party - #refvote#|nConservative Party - #convote#|nNationalist Party - #natvote#|n |nYou - #youvote#>
set numeric <comcal; %compap%>
set numeric <soccal; %socpap%>
set numeric <libcal; %libpap%>
set numeric <refcal; %refpap%>
set numeric <concal; %conpap%>
set numeric <natcal; %natpap%>
set numeric <youcal; %youpap%>
wait <Press any key to continue>
do <Points Allocation Proposal> } else {
msg <The parties have voted against the proposal by %novote% to %yesvote%. The parties voted as follows:|n|nCommunist Party - #comvote#|nSocialist Party - #socvote#|nLiberal Party - #libvote#|nReform Party - #refvote#|nConservative Party - #convote#|nNationalist Party - #natvote#|n |nYou - #youvote#>
wait <Press any key to continue>
do <Points Allocation Proposal> }
end define

Alex
29 Apr 2011, 12:08
Your "Points Allocation Proposal 2" procedure calls itself - maybe it's going into an infinite loop?