| Shmack - Jun-18-2005 server time | ||
ok help!! what did i do im getting and error saying newChar cannot have '.' infront if it...
|
| Shmack - Jun-18-2005 server time |
| ok thx guys got it im starting to work on the Attcking now and geting it to take away from my HP and the monsters HP i think i can figure that out jsut im wondering if in turing i could make some thing like a box with the arrow button you press to see more options like your internet adress bar can i do that in turing? |
| wtd - Jun-17-2005 server time | ||||||||
If you've doe something like:
Then you could output that information with something like:
Or, you might write a procedure like:
And then output that information with:
|
| Shmack - Jun-17-2005 server time |
| ok thc i got it workin but how do i call for the chars race str,agi,vit and wiz i tryed just typing in like put race ,strength, agility, vitality, wizardry but its saying that there not declaired |
| wtd - Jun-17-2005 server time | ||||||
Something like "toupper" and "tolowerr" or something like "Str.Upper". |
| Furball - Jun-16-2005 server time | ||||
Was there a turing function for that? |
| wtd - Jun-16-2005 server time | ||||
My apologies. Replace "player_stats" with "PlayerStats". |
| Shmack - Jun-16-2005 server time |
| ok this harder then i thought lol im still trying to get Attcking a monster (takeing away HP from player and monster) finding and useing items adding to status the only things i know how to use kinda is Procedure, a lil bit of functions umm thats about it lmao o god this will be hard XD but... i can do IT!! |
| Shmack - Jun-16-2005 server time | ||
| hmm when i try to run it its saying "player_stats" has not been declared.
sorry im not that turing smart and this program is meaning for me to pass or fail |
| Shmack - Jun-16-2005 server time |
| thx for the help guys like ALOT!!! lol hope you dont mind if i post more questions |
| wtd - Jun-16-2005 server time | ||
A suggestion: this doesn't cover something like hUman. Instead, first either completely upcase or downcase the string, then check it. |
| Furball - Jun-16-2005 server time |
| lol, wtd beat me to it! His example using the case statement would be much easier and more organized, so use that method instead. |
| Furball - Jun-16-2005 server time |
| For your procedure, you used parameters. When you created your procedure, you wrote charRace (var str, agi, vit, wiz: int), so when you call up your procedure, you have to insert values for those variables. so instead of calling up charRace, you will need to call up charRace (str's value, agi's value, vit's value, wiz's value). When you put a list of parameter's in a procedure (Like the ones you've shown) you have to call up the procedure and give values for the parameter. So, say you wrote charRace (15, 10, 12, 39) then the instances in your procedure would get those values (So, the first value would be your str = 15, then agi = 10, then vit = 12, then wiz = 39). For those lines of code, you shouldn't neec a procedure for it, unless you plan on repeating the same procedure numerous times. If u only plan on using that list of coding ONCE, I wouldn't create a procedure, it would be easier just to leave it out. But if you wanted to keep the procedure and make things a little more organized, I would just get rid of the parameters and used global variables. If you plan on passing the values for str, vit, agi, and wiz to other procedures, global variables would be the best thing to use. so just do something like this: var Str, Vit, Wiz, Agi : int %Global Variables var race : string put "What race would you like to be? ELF, HUMAN, UNDEAD: " get race procedure charRace (strA, vitA, wizA, agiA : int) %Parameters if race = "HUMAN" or race = "human" then strA := 15 vitA := 15 wizA := 5 agiA := 20 elsif race = "ELF"..... elsif race = "UNDEAD" %And so on end if end charRace %Then call it up: charRace (Str, Vit, Wiz, Agi) % What this lines does is it will call up your procedure. You will notice that there are your GLOBAL VARIABLES Str, Vit, Wiz and Agi in there. Those variables will gain the values u specify in the procedure. Even though the parameters are written differently (strA, vitA, wizA, agiA instead of Str, Vit, Wiz, Agi), no matter what name you call your variable, it will take the place of the parameter when it in the procedure (In other words, when you call up your procedure, Str = strA, Vit = vitA, Wiz= wizA, Agi = agiA)) so whatever values and formulas you use in your procedure that have to do with the parameters (strA, vitA, agiA, wizA), your global variables will be given the resulting values. |
| wtd - Jun-16-2005 server time | ||||||||
First off, you should use a record, rather than having individual variables for each of the stats.
Next you should use a case statement, rather than if, in this situation.
And of course, you don't sanity check the input. If the user selects 5, the program runs with bad information. Oh, and there's no reason to use a procedure, rather than a function.
Then you could do something like:
|
| Shmack - Jun-16-2005 server time |
| how do you call a procedure mines procedure charRace (var str, agi, vit, wiz : int) var choice : int put "Pick your Race." put " " put "1-Human (Str: 15 Agi:15 Vit:15 Wiz:15)" put " " put "2-Night elf (Str: 15 Agi:20 Vit:10 Wiz:15)" put " " put "3-Orc (Str: 20 Agi:10 Vit:20 Wiz:10)" put " " put "4-Undead (Str: 10 Agi:10 Vit:20 Wiz:20)" get choice if choice = 1 then race := "Human" str := 15 agi := 15 vit := 15 wiz := 15 elsif choice = 2 then race := "Night Elf" str := 15 agi := 20 vit := 10 wiz := 15 elsif choice = 3 then race := "Orc" str := 20 agi := 10 vit := 20 wiz := 10 elsif choice = 4 then race := "Undead" str := 10 agi := 10 vit := 20 wiz := 20 end if end charRace but how do i call it i tryed just charRace but that doesnt work |