Computer Science Canada

Issues with procedures, making a battle sim.

Author:  nine90nine [ Thu Nov 05, 2020 1:23 pm ]
Post subject:  Issues with procedures, making a battle sim.

What is it you are trying to achieve?
Trying to make a program for a fighting sim (like Pokémon kind of)


What is the problem you are having?
Having a procedure run at the end of another procedure. I try to run a proc that will put a GUI to select moves, but no matter where i put it, it will have issues with having something declared


Describe what you have tried to solve this problem
I tried with forward procedure, and body procedure but i had no luck, still possible i didn't implement it properly.

Please specify what version of Turing you are using
4.1.1 (if i got name wrong its the latest version lol)

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
BooHoo prepare for the worst program you have ever laid your eyes on

Author:  scholarlytutor [ Thu Nov 05, 2020 7:23 pm ]
Post subject:  RE:Issues with procedures, making a battle sim.

Looks like you know that you need both of these:

forward procedure enemyturn
forward procedure startgame

Put them before writing any of your other procedures (I put them on lines 34 and 35 of your code). Basically, procedures must be declared before they're used, so anytime you want to use the 'forward' technique to reference procedures that are written later in your program, put those forward statements right near the top of your program.

Also, don't forget to write body when writing the procedure you forwarded! (I believe you forgot to write body for your startgame function).

Author:  nine90nine [ Fri Nov 06, 2020 8:49 am ]
Post subject:  Re: RE:Issues with procedures, making a battle sim.

scholarlytutor @ Thu Nov 05, 2020 7:23 pm wrote:
Looks like you know that you need both of these:

forward procedure enemyturn
forward procedure startgame

Put them before writing any of your other procedures (I put them on lines 34 and 35 of your code). Basically, procedures must be declared before they're used, so anytime you want to use the 'forward' technique to reference procedures that are written later in your program, put those forward statements right near the top of your program.

Also, don't forget to write body when writing the procedure you forwarded! (I believe you forgot to write body for your startgame function).


Thank you so much! My program is saved yahoooo

i wasnt sure hwo to properaly use the forward and body command thanks for clearing that up for me Mr. Green

Author:  scholarlytutor [ Fri Nov 06, 2020 12:53 pm ]
Post subject:  RE:Issues with procedures, making a battle sim.

No problem! Happy to help.


: