Computer Science Canada Need some help with basic coding |
Author: | aspire [ Wed Sep 12, 2007 7:06 pm ] | ||
Post subject: | Need some help with basic coding | ||
Hello, I am new to Compsci and new to Turing. I am in grade 10 and taking a course that is using turing. Now I wanted to make a calculator and I was wondering how i can "call" on something for instance I am finding it hard to explain. Lets say someone enters in their level is 1. I want that levels amount to be subtracted from the total level and make it the "amountleft" variable. The reason im having trouble is I want to do this on a large scale, (99 levels or so)
I am having trouble explaining this. So if anyone is willing to help me, I can PM them the real code and see if you can help. The only reason why I didnt want to post it is because its quite long. Heres my contact info if you can help MSN: Beat-Of-Aspire@hotmail.com (Really only use this one) AIM: beckershoes1 Yahoo: jamiechese@yahoo.ca xfire: aspire0 Thanks to anyone who can get me going in the right direction!! |
Author: | Tony [ Wed Sep 12, 2007 7:29 pm ] |
Post subject: | RE:Need some help with basic coding |
It sounds like you are looking for an array. We have an excellent walkthrough for Turing Clayton has done something useful, and wrote up some good material on Arrays. You should probably limit yourself just to the first part of that tutorial for now. |
Author: | Clayton [ Wed Sep 12, 2007 7:34 pm ] |
Post subject: | RE:Need some help with basic coding |
Tony wrote: Clayton has done something useful...
Ouch... Although Tony is right, arrays do indeed sound like what you are looking for. As well, welcome to CompSci.ca! If you have any more questions, feel free to ask! |
Author: | aspire [ Wed Sep 12, 2007 7:45 pm ] |
Post subject: | RE:Need some help with basic coding |
Thanks for the help ![]() I will see if it works. Thanks again |
Author: | Tony [ Wed Sep 12, 2007 7:52 pm ] |
Post subject: | RE:Need some help with basic coding |
Oh come on Clayton! I'm trying to give you a complement, and even linking to something that you wrote! ![]() |
Author: | aspire [ Wed Sep 12, 2007 7:58 pm ] |
Post subject: | RE:Need some help with basic coding |
I am confused. Ok so I have the array. I still dont understand how to "connect" it to the levels lets say someone enters level 2 then i want it to subtract (amount of the level - total) I read the tutorial, I just am not sure how or if it applies to what im trying to get at >_< |
Author: | Clayton [ Wed Sep 12, 2007 8:00 pm ] |
Post subject: | RE:Need some help with basic coding |
Alright, fair enough. Thanks ![]() |
Author: | CodeMonkey2000 [ Wed Sep 12, 2007 8:09 pm ] |
Post subject: | RE:Need some help with basic coding |
Have an array of lvls, take the level that the user inputs and access that level with: lvl(level) |
Author: | aspire [ Wed Sep 12, 2007 8:18 pm ] | ||
Post subject: | RE:Need some help with basic coding | ||
Alright. Well I am really lost. So I will just post the whole thing. I am making it for a game my brother plays. Just thought it would be some good experience to practice with turing So lets say if someone enters 80 i want it to subtract "level 80's" amount from the total amount. Here is the stuff I currently have.
|
Author: | Tony [ Wed Sep 12, 2007 11:33 pm ] | ||
Post subject: | RE:Need some help with basic coding | ||
Well arrays are considered to be a more "advanced" concept, usually taught later in the year. The basic idea is that you can do things like
|
Author: | Nick [ Thu Sep 13, 2007 6:31 am ] | ||||
Post subject: | RE:Need some help with basic coding | ||||
ahaha i recognise that code anywheere thats a runescape level calculator (dont worry ppl i quit a while ago just have friends who still play... and a cousin) anyways it doesnt quite seem like u got arrays down yet... instead of making 99 diffrent varibles for each level just make a
then to set them just put
|
Author: | HeavenAgain [ Thu Sep 13, 2007 11:19 am ] |
Post subject: | RE:Need some help with basic coding |
normally for assigning array variables, we like to use a loop, instead of typing all the array's name again bad example would be, in this case: lvl (1) := 0 lvl (2) := 86.... etc if thats the case, then whats the point of using an array, it will be just the same to type up all the var lvl_1 blah blah blah. so try to find the increasing value, and do it in one small loop (unless its too complicated...) |
Author: | CodeMonkey2000 [ Thu Sep 13, 2007 11:58 am ] |
Post subject: | RE:Need some help with basic coding |
0_o aspire, seriously re-read Clayton's array tutorial and LEARN from it. |
Author: | aspire [ Thu Sep 13, 2007 12:53 pm ] | ||
Post subject: | RE:Need some help with basic coding | ||
Uh, codemonkey. I did read it. I was half alseep though last night, so I think i probably didnt totally let the info seep in. I have only been doing turing for about 1 week in school, so yeah I admit it, I am slow. I didnt want to agitate you or anything. But really, thanks for the current help everyone has given Well, I was messing around with it at school. I didnt get very far but I did set the arrays properly, (I think) Teacher told me I cant subtract arrays. I will be reading that tutorial over a few times when I get home too so, please bear with me.
|
Author: | Nick [ Thu Sep 13, 2007 2:17 pm ] | ||
Post subject: | RE:Need some help with basic coding | ||
dude u almost had it... with just a couple adjustments i completed your code here it is
now just look over the change (last line) and see where u went wrong... for a week in ur pretty good keep ur chiin up and keep on trying |
Author: | aspire [ Thu Sep 13, 2007 5:18 pm ] |
Post subject: | RE:Need some help with basic coding |
Wicked man. Thank you so much. It is greatly appreciated. |
Author: | Nick [ Thu Sep 13, 2007 6:12 pm ] |
Post subject: | RE:Need some help with basic coding |
no problem man just learn arrays fully then they will bocome ur greatest friend ![]() |
Author: | d2bb [ Fri Sep 14, 2007 11:37 pm ] |
Post subject: | RE:Need some help with basic coding |
personaly. I wouldnt do it this way, id have do it this way: If you havnt learned IF statements DONT read lines BELOW and go to turning walkthrough . ELSIF if experiance = # then lvl = lvl +1 end if |