
-----------------------------------
fluxflashor
Wed Jun 13, 2007 10:56 pm

ISU due tomorrow morning... my procedures arent working :(
-----------------------------------
Ok so I am under a very bad time limit right now, but I am having problems with procedures.

Here is an examle of the code, and the error that it outputs. I have used search, but cannot find something relative to fixing the issue.


procedure PLAYERONEDEATH
   put"Sorry ", P1NAME, "But you lose since your HP has gone to zero."
   put"Press 1 to play again with the same names and mages, 2 to restart, or 3 to end the game"
      get continue
         if (continue = 1) then
              BEGINTEXT
                 elsif (continue = 2) then
                     CHARACTERSELECT
                         elsif (continue = 3) then
         end if
end PLAYERONEDEATH


now the error is get is, and i get this 8 times with a bunch of different procedures, is:


'procedure's' may only be declared at the program, module, or monitor level


I do not understand it :(

Help quickly would be appreciated. Will be up all night. I hope I do not have to rewrite my entire program. For now I guess I will finish up my code. then wait on these procedures.

-----------------------------------
HeavenAgain
Wed Jun 13, 2007 11:29 pm

Re: ISU due tomorrow morning... my procedures arent working :(
-----------------------------------
i'm guess your problem would be 
         
 if (continue = 1) then
              BEGINTEXT
                 elsif (continue = 2) then
                     CHARACTERSELECT
                         elsif (continue = 3) then
         end if

check to see if those 2 procedures are delceared above this one?
if thats not the problem post back your code, and i'll have a looky

-----------------------------------
fluxflashor
Wed Jun 13, 2007 11:34 pm

Re: ISU due tomorrow morning... my procedures arent working :(
-----------------------------------
well actually, it isnt those that are the problem, I have declared those fine. I get the error from the beginning of the procedure

PLAYERONEDEATH

well here is some more code. Sorry for the bad coding practices, I am not good with all the organization.



procedure CHARACTERSELECT
put"Ok ", P1NAME, " You now must select your mage"
color (1)put"**********************************************"
color (1)put"* .::Blue Mage                               *"
color (1)put"*   !For Purchase Press 1!                   *"
color (1)put"* Attributes:                                *"
color (1)put"*            ~ HP       = 125                *"
color (1)put"*            ~ Armor    = 30                 *"
color (1)put"*            ~ Strength = Water Spells       *"
color (1)put"*            ~ Weakness = Electric Spells    *"
color (1)put"**********************************************"
color (4)put"**********************************************"
color (4)put"* .::Red Mage                                *"
color (4)put"*   !For Purchase Press 2!                   *"
color (4)put"* Attributes:                                *"
color (4)put"*            ~ HP       = 90                 *"
color (4)put"*            ~ Armor    = 40                 *"
color (4)put"*            ~ Strenght = Fire Spells        *"
color (4)put"*            ~ Weakness = Water Spells       *"
color (4)put"**********************************************"
color (6)put"**********************************************"
color (6)put"* .::Yellow Mage                             *"
color (6)put"*   !For Purchase Press 3!                   *"
color (6)put"* Attributes:                                *"
color (6)put"*            ~ HP       = 50                 *"
color (6)put"*            ~ Armor    = 70                 *"
color (6)put"*            ~ Strength = Lightning Spells   *"
color (6)put"*            ~ Weakness = Fire Spells        *"
color (6)put"**********************************************"
color (7)put"So what is your choice? 1, 2, or 3?"
get P1CHOICE
delay(500)
Text.Cls

put"Ok ", P2NAME, " You now must select your mage"
color (1)put"**********************************************"
color (1)put"* .::Blue Mage                               *"
color (1)put"*   !For Purchase Press 1!                   *"
color (1)put"* Attributes:                                *"
color (1)put"*            ~ HP       = 125                *"
color (1)put"*            ~ Armor    = 30                 *"
color (1)put"*            ~ Strength = Water Spells       *"
color (1)put"*            ~ Weakness = Electric Spells    *"
color (1)put"**********************************************"
color (4)put"**********************************************"
color (4)put"* .::Red Mage                                *"
color (4)put"*   !For Purchase Press 2!                   *"
color (4)put"* Attributes:                                *"
color (4)put"*            ~ HP       = 90                 *"
color (4)put"*            ~ Armor    = 40                 *"
color (4)put"*            ~ Strength = Fire Spells        *"
color (4)put"*            ~ Weakness = Water Spells       *"
color (4)put"**********************************************"
color (6)put"**********************************************"
color (6)put"* .::Yellow Mage                             *"
color (6)put"*   !For Purchase Press 3!                   *"
color (6)put"* Attributes:                                *"
color (6)put"*            ~ HP       = 50                 *"
color (6)put"*            ~ Armor    = 70                 *"
color (6)put"*            ~ Strength = Lightning Spells   *"
color (6)put"*            ~ Weakness = Fire Spells        *"
color (6)put"**********************************************" %All put statements have "Color (i)" 
color (7)put"So what is your choice? 1, 2, or 3?"            %to make lines match up in code
get P2CHOICE

/* Players Now Have Their Mages */

if (P1CHOICE = 1) then      %The following determines Health and Armor Attributes For Player One
  P1HP := 125
  P1DEFENCE := 30
  P1MAGECLASS :=  "WaterMage" 
     elsif (P1CHOICE = 2) then
       P1HP := 90
       P1DEFENCE := 40
       P1MAGECLASS :=  "FireMage" 
          elsif (P1CHOICE = 3) then
            P1HP := 50
            P1DEFENCE := 70
            P1MAGECLASS :=  "LightningMage" 
end if

if (P2CHOICE = 1) then     %The following determines Health and Armor Attributes For Player Two
  P2HP := 125
  P2DEFENCE := 30
  P2MAGECLASS := "IceMage" 
  P2WEAKATK := Blizzard
  P2MEDATK := BlizzardSpike
  P2STRONGATK := BlizzardBlast
     elsif (P2CHOICE = 2) then
       P2HP := 90
       P2DEFENCE := 40
       P2MAGECLASS := "FireMage" 
          elsif (P2CHOICE = 3) then
            P2HP := 50
            P2DEFENCE := 70
            P2MAGECLASS := "LightningMage" 
end if

Text.Cls
end CHARACTERSELECT 
/*===============================================================================================*/


/*===================================================*/
procedure CONFIRMATION
put"FOR TESTING DISPLAY ATTRIBUTES"
put"PLAYER ONE HEALTH: ",P1HP      
put"PLAYER ONE ARMOR: ",P1DEFENCE 
put"PLAYER ONE MAGE CLASS: ", P1MAGECLASS 
put"PLAYER TWO HEALTH: ",P2HP      
put"PLAYER TWO ARMOR: ",P2DEFENCE  
put"PLAYER TWO MAGE CLASS: ",P2MAGECLASS
put"END TESTING OF VARAIABLES" 
end CONFIRMATION
/*====================================================*/


put"Are you ready to duel? [yes or no]"
get duelanswer
if (duelanswer = "yes") then


/*============================================================================================================*/
procedure BEGINTEXT
Text.Cls
put" ______              _ "       
put"(____  |            (_) "      
put" ____)  )_____  ____ _ ____"  
put"|  __  (| ___ |/ _  | |  _ | " 
put"| |__)  ) ____( (_| | | | | | "
put"|______/|_____)|___ |_|_| |_| "
put"              (_____| "    
delay (750)
Text.Cls
end BEGINTEXT
/*=============================================================================================================*/

% PROCEDURES NEEDED FOR PLAYERTURNS
/*-----------------------------------------*/
procedure PLAYERONEDEATH
   put"Sorry ", P1NAME, "But you lose since your HP has gone to zero."
   put"Press 1 to play again with the same names and mages, 2 to restart, or 3 to end the game"
      get continue
         if (continue = 1) then
              BEGINTEXT
                 elsif (continue = 2) then
                     CHARACTERSELECT
                         elsif (continue = 3) then
         end if
end PLAYERONEDEATH
/*-----------------------------------------*/
/*-----------------------------------------*/
procedure  PLAYERTWODEATH
   put"Sorry", P2NAME, "But you lose since your HP has gone to zero."
   put"Press 1 to play again with the same names and mages, 2 to restart, or 3 to end the game"
      get continue
         if (continue = 1) then
              BEGINTEXT
                 elsif (continue = 2) then
                     CHARACTERSELECT
                         elsif (continue = 3) then
                           
         end if
end PLAYERTWODEATH
/*-----------------------------------------*/
/*-----------------------------------------*/
procedure PLAYERONETURN
  put P1NAME, " It is now your turn." delay (200)
  put"What would you like to do?" delay (200)
  put" "
  put" "
  put" "
end PLAYERONETURN
/*-----------------------------------------*/

/*-----------------------------------------*/
procedure PLAYERTWOTURN

end PLAYERTWOTURN
/*-----------------------------------------*/




/*=============================================================================================================*/
procedure PLAYERTURNS
   loop
     /*-----*/ 
       if (P1HP = 0) then             % Checks to see if player one is dead. 
              PLAYERONEDEATH          % If he/she is, Player Two Wins
         else
              PLAYERONETURN           % If he isn't, the program will let playerone have his turn
           end if

           if (P2HP = 0) then         % Checks to see of player two is dead
              PLAYERTWODEATH          % If he/she is, Player One Wins
         else
              PLAYERTWOTURN           % If he/she isn't, the program will let playertwo have his turn 
       end if
     /*-----*/
   end loop
end PLAYERTURNS
/*==============================================================================================================*/

procedure END

end END
/* This is The Program's Structure {NOT TO BE MODIFIED} */

/**/
INSTRUCTIONS
/**/
NAMEINPUT
/**/
CHARACTERSELECT
/**/
CONFIRMATION
/**/
BEGINTEXT
/**/
PLAYERTURNS
/**/
END
/**/

/* This is the end of the Program's Structure */


Thats the enitre program, no variables though edited those out. Yes its a little incomplete. but most procedures DO work. Thank you for the reply.

-----------------------------------
HeavenAgain
Wed Jun 13, 2007 11:44 pm

RE:ISU due tomorrow morning... my procedures arent working :(
-----------------------------------
i dont see any problem with the code you just pasted there, all i see is delcearation problem (because your program is incompleete) can you post the full one in a zip?

edit : well its pretty late, and i got an exam tomorrow so good luck,  and i took another look at your program, you see when (duelanswer = "yes" ) then ..... you have a bunch a procedure after that, try moving the procedures after CHARACTERSELECT procedure, and then instead of wirting the procedure, you just call to its name :) i think that was the problem  :wink:  good luck on your ISU, and looking forward to see this on the submission forum  :lol:

-----------------------------------
fluxflashor
Thu Jun 14, 2007 5:45 am

RE:ISU due tomorrow morning... my procedures arent working :(
-----------------------------------
Ok I will try that. I fell asleep at my computer gotta hurry up with this thing now.

Thanks alot for the help, I will be posting it maybe a little later on today.

-----------------------------------
fluxflashor
Thu Jun 14, 2007 7:55 am

RE:ISU due tomorrow morning... my procedures arent working :(
-----------------------------------
Well ISU is finised. It worked perfectly. Once again thanks. Have some bits :D

I will post exe later. FULL SOURCE when the year is over. [couple days]
