Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Goto feature
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
azndragon




PostPosted: 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?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Dec 10, 2002 7:13 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dan




PostPosted: 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
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Tony




PostPosted: Tue Dec 10, 2002 9:55 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dan




PostPosted: 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 Wink
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
azndragon




PostPosted: Wed Dec 11, 2002 3:53 pm   Post subject: (No 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 Confused
Tony




PostPosted: Wed Dec 11, 2002 4:59 pm   Post subject: (No subject)

why not just comment it out then?

highlight what you don't want, then go to Edit -> Comment (i think)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
azndragon




PostPosted: Wed Dec 11, 2002 7:52 pm   Post subject: (No 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?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Dec 11, 2002 8:18 pm   Post subject: (No 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 Confused

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 Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
azndragon




PostPosted: Wed Dec 11, 2002 8:21 pm   Post subject: (No subject)

In the file that is saved when the program is run, the display is just a 0.
Tony




PostPosted: Wed Dec 11, 2002 8:51 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
azndragon




PostPosted: Wed Dec 11, 2002 9:57 pm   Post subject: (No 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 Razz
krishon




PostPosted: Wed Dec 11, 2002 10:20 pm   Post subject: (No subject)

****
Tony




PostPosted: Wed Dec 11, 2002 11:22 pm   Post subject: (No 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
azndragon




PostPosted: Fri Dec 13, 2002 9:13 am   Post subject: (No subject)

code:

procedure loadgame
open: stremin, "turing",get
get:stremin, character_name
get:stremin, character_gender
get:stremin, character_class
get:stremin, character_status
get:stremin, character_charisma
get:stremin, character_luck
get:stremin, character_dexterity
get:stremin, character_intelligence
get:stremin, character_vitality
get:stremin, character_agility
get:stremin, character_strength
get:stremin, character_currenthp
get:stremin, character_currentmp
get:stremin, character_maxhp
get:stremin, character_maxmp
close:stremin
end loadgame


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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 25 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: