Computer Science Canada Goto feature |
Author: | azndragon [ Tue Dec 10, 2002 6:32 pm ] |
Post subject: | Goto feature |
Is there a feature so that if a certain condition is satisfied, it goes to a certain place in the code, like a line number or something? |
Author: | Tony [ Tue Dec 10, 2002 7:13 pm ] |
Post subject: | |
there is no GoTo in turing to my knowledge, but it is available in Visual Basic. In turing you can get to a portion of code needed by calling up procedures/functions or setting up flags to move through loops. loop if flag = true then exit end if ... exit end loop By setting flag to be true, you will skip this loop and go straight to the end of it. Exit right before the end makes sure loop doesn't repeat. |
Author: | Dan [ Tue Dec 10, 2002 9:49 pm ] |
Post subject: | dam goto |
i dont know if you saw my other post about goto fuctions but here is a sumery Quote: FOR THE LOVE OF GOD DO NOT USE GOTO IN YOUR PORGAMES!!!!!!!!! this uless you know what you are doing or are using it for error checking. not much good can come from goto. use a loop of some kind to make your progame repeat or use fuctions/prosgeres |
Author: | Tony [ Tue Dec 10, 2002 9:55 pm ] |
Post subject: | |
dan, we went over this before... Anything can be dangerous if you don't know what you're doing... loops for example. If you "forget" to put a proper exit statment, you'll get into an infinate loop. Just like you can GoTo wrong spot... Same chances actually. |
Author: | Dan [ Tue Dec 10, 2002 10:02 pm ] |
Post subject: | kill the goto |
i know but i relay relay relay have isuses ageasted goto, it is relay just my opiean. but i also think that it makes you look like a poor porgamer if you uses it too much in a progame, it just is not neacery. well w/e. i just hope it is not in turing |
Author: | azndragon [ Wed Dec 11, 2002 3:53 pm ] |
Post subject: | |
Well, I'm only using it because it takes quite a while to test my program, and it's kinda annoying going through the same processes over and over again |
Author: | Tony [ Wed Dec 11, 2002 4:59 pm ] |
Post subject: | |
why not just comment it out then? highlight what you don't want, then go to Edit -> Comment (i think) |
Author: | azndragon [ Wed Dec 11, 2002 7:52 pm ] |
Post subject: | |
Okay, another problem, when I try to retrieve the data using the get statement, most of it loads, except one is saying "Invalid integer input". I checked it out, and it turns out that the value that it's trying to load is a 0. Will that cause any problems with my loading, or is there something wrong with my code? EDIT: Okay, it's not something wrong with my code, because I cut out the code that loads the variable with 0's stored as them, and it works fine. Now all I need to know is how to get Turing to load all the variables, even if they are zeros. Also, one more thing, I want the user to enter a normal number in certain parts of the game. Is there a code or something that converts all decimal numbers to integers so that the program doesn't crash when a real number is inputted where an integer should be? |
Author: | Tony [ Wed Dec 11, 2002 8:18 pm ] |
Post subject: | |
is it 0(Zero) or NULL ? cuz they are different. Though I donno, maybe its the way you read it or something. 0 is an integer Yes, there're 3 ways you can change real to integer. round() ceil() floor() all 3 round the real value and return integer. Ceil always rounds up and floor always rounds down. also intreal() converts integer back to real |
Author: | azndragon [ Wed Dec 11, 2002 8:21 pm ] |
Post subject: | |
In the file that is saved when the program is run, the display is just a 0. |
Author: | Tony [ Wed Dec 11, 2002 8:51 pm ] |
Post subject: | |
maybe there're some hidden characters? though its unlikely... you can always take input as string and convert it to w/e you want after. |
Author: | azndragon [ Wed Dec 11, 2002 9:57 pm ] |
Post subject: | |
If I sent you my source, do you think you could help me with my get statements? It's too long to post here |
Author: | krishon [ Wed Dec 11, 2002 10:20 pm ] |
Post subject: | |
**** |
Author: | Tony [ Wed Dec 11, 2002 11:22 pm ] |
Post subject: | |
krishon, don't push things... Please make sure you know who you're sending your source code to if it has any value to you Just post your GET part here. |
Author: | azndragon [ Fri Dec 13, 2002 9:13 am ] | ||
Post subject: | |||
That's the basic format of my get statement, there's more, but it's in the same format, so I'm not going to post it |
Author: | Tony [ Fri Dec 13, 2002 2:39 pm ] |
Post subject: | |
well everything seems ok in code part... unless there's a type mismatch. I really don't know what could be wrong... Try replaces 0s with 1s... I shouldn't make that much of a difference in stats of RPG character (if thats what you're making) |
Author: | Dan [ Fri Dec 13, 2002 5:33 pm ] |
Post subject: | also... |
also make shure you are not reading pasted the end of the file and that the file is where it is sposted to be. |
Author: | krishon [ Sun Dec 15, 2002 1:22 pm ] |
Post subject: | |
yah...basically just make sure all the variables are in the rite order and there are the same amount, like Dan said. You can try downloading Dan's game to make sure you have it rite (just a suggestion, u can if u want) |
Author: | azndragon [ Sun Dec 15, 2002 5:37 pm ] |
Post subject: | |
krishon wrote: yah...basically just make sure all the variables are in the rite order and there are the same amount, like Dan said. You can try downloading Dan's game to make sure you have it rite (just a suggestion, u can if u want)
Well, most of it worked, just the bottom half didn't. Is there a limit to how many variables it can load? Since mine has 103, I'm thinking that it could be a possibility. |
Author: | Tony [ Sun Dec 15, 2002 5:52 pm ] |
Post subject: | |
actually there might be a problem with that... I know that martin used a lot of variables in his RPG (mostly for tilesets) and after a while, sertain variables just "disappeared". Don't ask me whats going on, I'm just saying that turing has a reputation of comming up with most random errors you can find in compyland. |
Author: | Dan [ Sun Dec 15, 2002 7:25 pm ] |
Post subject: | same |
same thing hapend to me when i as making QFTB, the problem is turing can only holed so many vars for pics and stuff. i had over 300 vars loaded for pics and turing eventley stared overlapng the pic vars intell they stoped showing up i got wired errors. to fix it you have to delte the old pics from the meroery and you can also try loading them in the same var. |
Author: | azndragon [ Sun Dec 15, 2002 9:46 pm ] |
Post subject: | Re: also... |
Hacker Dan wrote: also make shure you are not reading pasted the end of the file and that the file is where it is sposted to be.
What do you exactly mean by this? |
Author: | Tony [ Sun Dec 15, 2002 10:24 pm ] |
Post subject: | |
well if you're getting EOF error... that means you're reading too much from that file. And if the file is not in the right place, you'll get something like "file can't be opened" error. |
Author: | krishon [ Mon Dec 16, 2002 7:47 pm ] |
Post subject: | |
lol, good work tony, ur at 200, newayz, u could try putting several files which can load the different variables for example, you can put a certain number of variables in one section, and other variables in other sections until all the variables can be loaded and saved. just remember, if you save a certain number of files in the turing file, make sure the loading file has the EXACT same order and names for the variables you are tryin to load. maybe that can help |
Author: | azndragon [ Sat Dec 28, 2002 7:51 pm ] |
Post subject: | |
Oh wow, I fixed it. It's because I used write and read statements instead of put and get statements. I don't know why this is, but it works! |