Computer Science Canada Loop inside a function |
Author: | coolest35 [ Mon Dec 01, 2003 7:27 pm ] | ||
Post subject: | Loop inside a function | ||
Hi ![]() ![]() ![]() below is the code that i have for the winning screen right now... ![]()
|
Author: | Mazer [ Mon Dec 01, 2003 7:32 pm ] | ||
Post subject: | |||
yeah, you can't have a file include itself in the file... otherwise you'd have one infinitely big file and just about zero hard drive space. make the you win program into a proc:
now, put your main game in a loop and at the line where it has the inlcude line to show the winning screen, replace it with winscreen and at the part where it asks the user if s/he wants to play again, just have an if statement that will exit the loop if the answer is no. |
Author: | coolest35 [ Mon Dec 01, 2003 8:09 pm ] |
Post subject: | IT DOESN'T WORK.... :( |
Hi , that what so ever doesn't make sense to me ![]() ![]() ![]() ![]() ![]() Quote: now, put your main game in a loop and at the line where it has the inlcude line to show the winning screen, replace it with winscreen and at the part where it asks the user if s/he wants to play again, just have an if statement that will exit the loop if the answer is no.
|
Author: | Andy [ Mon Dec 01, 2003 8:20 pm ] |
Post subject: | |
ok here is what u do... compile it to an exe, then use Sys.Exec at the end |
Author: | coolest35 [ Mon Dec 01, 2003 8:26 pm ] |
Post subject: | Sys.Exec |
Ok i did this : if reply = "y" then sys.exec " Battleship.exe" what do i do .. it comes up as an error .. if some can fix that code up plz do so.. thnx...i'm having trouble with it! |
Author: | Andy [ Mon Dec 01, 2003 8:33 pm ] | ||
Post subject: | |||
have
|
Author: | AsianSensation [ Mon Dec 01, 2003 8:38 pm ] | ||
Post subject: | |||
don't listen to dodge, Sys.Exec is what I used on my program when I got lazy. you don't even have to use include. when you want to exit the winning screen do something like this:
put that into the main loop, now whenever they press a key when that shows up, then it takes them back to the main loop again, so they can play it again. |
Author: | Andy [ Mon Dec 01, 2003 8:40 pm ] |
Post subject: | |
if ur gonna do that, dont define any variables in the loop or it'll crash |
Author: | Mazer [ Mon Dec 01, 2003 8:49 pm ] |
Post subject: | |
coolest, that shouldn't have given you errors. could you post the code so i can see what you did? otherwise dodge is going to suggest how to make the game loop using whatdotcolour |
Author: | AsianSensation [ Mon Dec 01, 2003 8:52 pm ] |
Post subject: | |
maybe he had couple of variables all with the same name? When you do that and then use include, it will give you an error. There were tons of errors with mine when I tried to use include in my final project. And since I found that out at the last moment, I got lazy and didn't fix it by renaming everything. So I made bunch of stuff into executables, and then use Sys.Exec to access them, lol. |
Author: | Andy [ Mon Dec 01, 2003 8:56 pm ] |
Post subject: | |
if u wana use whatdotcolor for that... keep on drawing dots outside of the screen and then you can measure the number of dots.. lol if you wanna know how, post here |
Author: | Mazer [ Mon Dec 01, 2003 8:58 pm ] |
Post subject: | |
i told you so. well, let's have it dodge, show us the way of the Whatdotcolor Warrior (hey... that could be a movie...) warning: coolest35, if you actually care to understand how to solve your problem, ignore dodge's whatdotcolor post (no offence to dodge) |
Author: | coolest35 [ Mon Dec 01, 2003 8:58 pm ] |
Post subject: | ok... |
ok .. i listen to both of you and did the stuff u told me it worked.. but after the hash part.. i put include "battleship12.t" ( main file name instead of the .exe ) it doesn't work.. ok.. i have submitted as attachments the main files.. just comment out the picture parts so it works.. ok.. and thanx to all who help.. i'm sooooooo confused... :cry: :?: |
Author: | Mazer [ Mon Dec 01, 2003 9:06 pm ] |
Post subject: | |
hmm.... couldn't run it even after commenting out the picture parts because there are other included files that you left out, and after commenting those out i got errors of some window variable not being declared. where should i be looking for the end of the game when the victory/defeat screen is displayed and the user is asked if they want to play again? |
Author: | coolest35 [ Mon Dec 01, 2003 9:10 pm ] |
Post subject: | BSRESULT |
it should be in the bsresult .. which says to include the file VICTORY.T which is attached... uh MAZOR do u have msn or any chatting program.. because i am getting tired of posting messages i'll ask u directly |
Author: | Mazer [ Mon Dec 01, 2003 9:20 pm ] |
Post subject: | |
aww... but i don't get any bits on msn... hehe. yeah, ncoutsos@hotmail.com |
Author: | Andy [ Mon Dec 01, 2003 9:23 pm ] | ||
Post subject: | |||
here u go nick
|
Author: | Mazer [ Mon Dec 01, 2003 9:35 pm ] |
Post subject: | |
my goodness. you truly are the Whatdotcolor Warrior. i'm gonna start a petition to get your name/rank changed accordingly. honestly |
Author: | Andy [ Mon Dec 01, 2003 9:40 pm ] |
Post subject: | |
oops, thats for DBZ's program... damn oh well... |
Author: | Mazer [ Mon Dec 01, 2003 9:42 pm ] |
Post subject: | |
doesn't matter. you're still the WW |