An excellent point. For what it's worth, SourceCoder can do the indentation for you automatically. Smile I propose that the While 1 loops were intended to not be:
Code:
:While 1
:¦ getKey→E
But to instead be:
Code:
:Repeat E
:| getKey→E
:End
I see four getKey instances at first glance, so this would solve a lot of the missing Ends, besides forcing the calculator to wait for a key.
KermMartian wrote:
Beta7 wrote:
As per KermMartian's request (yes, I just had to stick that in here Razz ) :

*Bump*

I added the 2 missing Ends where Kerm said they needed to go, and the program still isn't going past the Fight/Hide menu. In fact, it's now to the point where it just flashes the menu, then goes back to the map/movement program.
It's not a bump if you're not double-posting and it's not a necrothread, usually. Smile So I looked more closely at your code, and I think I understand what you misunderstand. Reading your code, you think that getKey waits until a key is pressed, then returns that keycode, right? That's wrong. getKey always returns immediately, returning 0 if no key was pressed or the non-zero keycode if a key was pressed.


I knew it returned immediately (and that was why it had to be in a loop so it would keep asking until you pressed something). I was trying to lump everything into one big loop like tifreak8x had on his "Collision Detection" tutorial on his website.

I fixed the code (at least, I think I did Razz ). Does this look better?


Code:
:ClrDraw
:Text(0,25,"BATTLE!
:Text(15,25,Str3
:Text(25,25,"1. FIGHT
:Text(35,25,"2. HIDE
:While 1
:¦ getKey→E
:¦ If E=93:Then
:¦ ¦ randInt(1,20→R
:¦ ¦ If R≤L3(10:Then
:¦ ¦ ¦ Text(45,25,"ESCAPED!
:¦ ¦ ¦ Pause :ClrDraw:Return:End
:¦ ¦ If R>L3(10:Then
:¦ ¦ ¦ Text(45,25,"CAN'T ESCAPE!
:¦ ¦ ¦ Pause
:¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ 92→E:End:End
:¦ If E=92:Then
:¦ ¦ Lbl 1
:¦ ¦ Text(0,25,"CHOOSE WEAPON
:¦ ¦ Text(25,25,"1. HUMAN
:¦ ¦ Text(35,25,"2. COVENANT
:¦ ¦ 0→E:0→F:0→G
:¦ ¦ While 1
:¦ ¦ ¦ getKey→E
:¦ ¦ ¦ If E=92:Then
:¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦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 ¦ ¦
:¦ ¦ ¦ ¦ 0→F
:¦ ¦ ¦ ¦ While 1
:¦ ¦ ¦ ¦ ¦ getKey→F
:¦ ¦ ¦ ¦ ¦ If F=92:Then
:¦ ¦ ¦ ¦ ¦ ¦ L1(28→L2(48
:¦ ¦ ¦ ¦ ¦ ¦ L1(29→L2(49
:¦ ¦ ¦ ¦ ¦ ¦ L2(24)-L1(30→L2(24
:¦ ¦ ¦ ¦ ¦ ¦ L2(24→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ L2(25→L2(51
:¦ ¦ ¦ ¦ ¦ ¦ "PLASMA PISTOL→Str1:End
:¦ ¦ ¦ ¦ ¦ If F=93:Then
:¦ ¦ ¦ ¦ ¦ ¦ L1(31→L2(48
:¦ ¦ ¦ ¦ ¦ ¦ L1(32→L2(49
:¦ ¦ ¦ ¦ ¦ ¦ L2(26)-L1(33→L2(26
:¦ ¦ ¦ ¦ ¦ ¦ L2(26→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ L2(27→L2(51
:¦ ¦ ¦ ¦ ¦ ¦ "PLASMA RIFLE→Str1:End
:¦ ¦ ¦ ¦ ¦ If F=94:Then
:¦ ¦ ¦ ¦ ¦ ¦ L1(34→L2(48
:¦ ¦ ¦ ¦ ¦ ¦ L1(35→L2(49
:¦ ¦ ¦ ¦ ¦ ¦ L2(28)-L1(36→L2(28
:¦ ¦ ¦ ¦ ¦ ¦ L2(28→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ L2(29→L2(51
:¦ ¦ ¦ ¦ ¦ ¦ "NEEDLER→Str1:End
:¦ ¦ ¦ ¦ ¦ If F=82:Then
:¦ ¦ ¦ ¦ ¦ ¦ L1(49→L2(48
:¦ ¦ ¦ ¦ ¦ ¦ L1(50→L2(49
:¦ ¦ ¦ ¦ ¦ ¦ L2(38)-L1(51→L2(38
:¦ ¦ ¦ ¦ ¦ ¦ L2(38→L2(50
:¦ ¦ ¦ ¦ ¦ ¦ L2(39→L2(51
:¦ ¦ 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100→θ
:¦ ¦ If θ≤L3(4:Then
:¦ ¦ ¦ L2(2)-L3(5→L2(2
:¦ ¦ ¦ If L2(2≤0:Then
:¦ ¦ ¦ ¦ L2(1)+L2(2→L2(1
:¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ¦ Text(15,25,Str2," HAS NO SHIELDS!
:¦ ¦ ¦ ¦ Pause
:¦ ¦ ¦ ¦ If L2(1≤0:Then
:¦ ¦ ¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ ¦ ¦ Text(35,25,Str2," DIED!
:¦ ¦ ¦ ¦ ¦ Pause
:¦ ¦ ¦ ¦ ¦ prgmHALODELV
:¦ ¦ ¦ ¦ ¦ Stop
:¦ ¦ ¦ ¦ End:End:End
:¦ ¦ If θ>L3(4:Then
:¦ ¦ ¦ ClrDraw
:¦ ¦ ¦ Text(35,25,Str3," MISSED!
:¦ ¦ ¦ Pause:End
:¦ ¦
:¦ End:End
I guess that's better, but I see several things that make me unhappy

1) You have a Lbl and a Goto inside a While loop. The Goto jumps from an inner loop into a more outer loop; memory leaking occurs. Use a variable flag to break out of the inner loop instead.
2) Related problem: You have nested While 1 loops. Since While 1 loops loop infinitely, it's impossible to leave the inner loop and return to the outer loop without Returning or causing a memory leak. You do the latter.
Kerm, I've decided that it'll be easier if I just retype the whole thing, since I'm going to switch out the Whiles for Repeats, and will try to tidy up the loading information part.

I'll try to get it finished by tomorrow - if it's good, then the only thing I have to do to finish my game is make an in-game menu (for which I think I'll try Mufin's GECUMSY Wink ), and events for the maps. Very Happy
Beta7 wrote:
Kerm, I've decided that it'll be easier if I just retype the whole thing, since I'm going to switch out the Whiles for Repeats, and will try to tidy up the loading information part.

I'll try to get it finished by tomorrow - if it's good, then the only thing I have to do to finish my game is make an in-game menu (for which I think I'll try Mufin's GECUMSY ;) ), and events for the maps. :D

Try to be sure you understand how the code works (although if at the moment you don't understand it yet, that's not terrible) and do let me know how it works for you.
Oh, I have no freakin' clue how a lot of it works after the text part at the beginning (so the actual code itself Razz ) - but I plan on searching through tutorials and guides (plus your readme) first, to see if I can learn anything. Wink Laughing
Beta7, sounds good; I hope you'll show us your new code after you type it up. Good luck on the rewrite.
Here is what I came up with:

HALOBAT

Code:
:Lbl 1
:ClrDraw
:Text(0,25,"BATTLE!
:Text(15,25,"1. FIGHT
:Text(25,25,"2. HIDE
:0→E:0→F:0→G:0→H:0→I:0→J:0→R
:Repeat E
:getKey→E
:End
:If E≠92 and E≠93:Goto 1
:If E=93:Then
:randInt(1,20→R
:If R≤{L3}(10:Then
:Text(45,25,"ESCAPED!
:Pause
:0→E:0→F:0→G:0→H:0→I:0→R
:ClrDraw:Return:End
:If R>{L3}(10:Then
:Text(45,25,"CAN'T ESCAPE!
:Pause
:ClrDraw
:92→E:End:End
:Lbl 2
:0→F:0→G:0→H:0→I:0→R
:If E=92:Then
:ClrDraw
:Text(0,25,"CHOOSE WEAPON
:Text(25,25,"1. HUMAN
:Text(35,25,"2. COVENANT
:Repeat F
:getKey→F
:End:End
:If F≠92 and F≠93:Goto 2
:If F=92:Then
:ClrDraw
:Text(0,25,"CHOOSE WEAPON
:Text(15,5,"1. MAGNUM      ",{L2}(6),"/",{L2}(7
:Text(25,5,"2. ASSAULT RIFLE      ",{L2}(8),"/",{L2}(9
:Text(35,5,"3. SHOTGUN      ",{L2}(16),"/",{L2}(17
:Text(45,5,"4. SNIPER RIFLE      ",{L2}(18),"/",{L2}(19
:Text(55,5,"5. FRAG GRENADE      ",{L2}(3
:Text(55,72,"BACK
:0→H
:Repeat G
:getKey→G
:End:End
:If F=92 and G≠92 and G≠93 and G≠94 and G≠82 and G≠83:Goto 2
:If F=93:Then
:ClrDraw
:Text(0,25,"CHOOSE WEAPON
:Text(15,5,"PLASMA PISTOL      ",{L2}(24),"/",{L2}(25
:Text(25,5,"PLASMA RIFLE      ",{L2}(26),"/",{L2}(27
:Text(35,5,"NEEDLER      ",{L2}(28),"/",{L2}(29
:Text(45,5,"ENERGY SWORD      ",{L2}(38),"/",{L2}(39
:Text(55,5,"PLASMA GRENADE      ",{L2}(4
:Text(55,72,"BACK
:0→G
:Repeat H
:getKey→H
:End:End
:If F=93 and H≠92 and H≠93 and H≠94 and H≠82 and H≠83:Goto 2
:If G=92:Then
:{L1}(1→{L2}(48
:{L1}(2→{L2}(49
:{L2}(6)-{L1}(3→{L2}(6
:{L2}(6→{L2}(50
:{L2}(7→{L2}(51
:"MAGNUM→Str1:End
:If G=93:Then
:{L1}(4→{L2}(48
:{L1}(5→{L2}(49
:{L2}(8)-{L1}(6→{L2}(8
:{L2}(8→{L2}(50
:{L2}(9→{L2}(51
:"ASSAULT RIFLE→Str1:End
:If G=94:Then
:{L1}(16→{L2}(48
:{L1}(17→{L2}(49
:{L2}(16)-{L1}(18→{L2}(16
:{L2}(16→{L2}(50
:{L2}(17→{L2}(51
:"SHOTGUN→Str1:End
:If G=82:Then
:{L1}(19→{L2}(48
:{L1}(20→{L2}(49
:{L2}(18)-{L1}(21→{L2}(18
:{L2}(18→{L2}(50
:{L2}(19→{L2}(51
:"SNIPER RIFLE→Str1:End
:If G=83:Then
:{L1}(52→{L2}(48
:{L1}(53→{L2}(49
:{L2}(3)-{L1}(54→{L2}(3
:{L2}(3→{L2}(50
:4→{L2}(51
:"FRAG GRENADE→Str1:End
:If H=92:Then
:{L1}(28→{L2}(48
:{L1}(29→{L2}(49
:{L2}(24)-{L1}(30→{L2}(24
:{L2}(24→{L2}(50
:{L2}(25→{L2}(51
:"PLASMA PISTOL→Str1:End
:If H=93:Then
:{L1}(31→{L2}(48
:{L1}(32→{L2}(49
:{L2}(26)-{L1}(33→{L2}(26
:{L2}(26→{L2}(50
:{L2}(27→{L2}(51
:"PLASMA RIFLE→Str1:End
:If H=94:Then
:{L1}(34→{L2}(48
:{L1}(35→{L2}(49
:{L2}(28)-{L1}(36→{L2}(28
:{L2}(28→{L2}(50
:{L2}(29→{L2}(51
:"NEEDLER→Str1:End
:If H=82:Then
:{L1}(49→{L2}(48
:{L1}(50→{L2}(49
:{L2}(38)-{L1}(51→{L2}(38
:{L2}(38→{L2}(50
:{L2}(39→{L2}(51
:"ENERGY SWORD→Str1:End
:If H=83:Then
:{L1}(55→{L2}(48
:{L1}(56→{L2}(49
:{L2}(4)-{L1}(57→{L2}(4
:{L2}(4→{L2}(50
:4→{L2}(51
:"PLASMA GRENADE→Str1:End
:prgmHALOBAT2


HALOBAT2

Code:
:ClrDraw
:1→J:0→I
:randInt(1,100→θ
:If θ>{L2}(49:Then
:Text(15,25,Str2," MISSED!
:Pause
:End
:If θ≤{L2}(49:Then
:Text(15,25,Str2," HIT!
:Pause
:{L3}(2)-{L2}(48→{L3}(2
:If 0≥{L3}(2:Then
:{L3}(1)+{L3}(2→{L3}(1
:0→{L3}(2
:Text(25,25,Str3," HAS NO SHIELDS!
:Pause
:End
:If 0≥{L3}(1:Then
:0→J
:Text(35,25,Str3," DIED!
:Pause
:End
:If J=0:Then
:randInt(1,20→θ
:If θ≤{L3}(6:Then
:Text(45,25,Str3," DROPPED WEAPON
:Pause
:randInt({L3}(7),{L3}(8))→θ
:If θ>{L2}(50:θ→{L2}(50
:If {L2}(50)>{L2}(51:{L2}(51→{L2}(50
:End:End:End
:If J=1:Then
:ClrDraw
:randInt(1,100→θ
:If θ>{L3}(4:Then
:Text(15,25,Str3," MISSED!
:Pause
:End
:If θ≤{L3}(4:Then
:Text(15,25,Str3," HIT!
:Pause
:{L2}(2)-{L3}(5→{L2}(2
:If 0≥{L2}(2:Then
:{L2}(1)-abs({L2}(2→{L2}(1
:Text(25,25,Str2," HAS NO SHIELDS!
:Pause :End
:If 0≥{L2}(1:Then
:ClrDraw
:Text(35,25,Str2," DIED!
:Pause
:End:End:End
:If 0<{L2}(1 and 0<{L3}(1:prgmHALOBAT
:"If 0<{L2}(1 and 0≥{L3}(1
:If 0≥{L2}(1:Then
:
:Stop
:End



I have a few problems with this code, though (and yes, I made sure I had an appropriate number of then/while/repeat vs. ends Wink ).

- First off, when I run the HALOBAT program, it doesn't run the HALOBAT2 program when it is done with loading the weapon information.
- Second, I get an "Invalid Dim" after the user and the enemy attack; the Goto takes me to the end of the code in HALOBAT2 where I tell it to run HALOBAT again if both guys are above 0 HP (is right on the colon before the "prgm" command).

How do I fix these problems (and, consequently, what is causing them - so I don't make the mistakes again Wink )?
Quote:
- First off, when I run the HALOBAT program, it doesn't run the HALOBAT2 program when it is done with loading the weapon information.
Does the weapon information get loaded into Str1 and the lists properly? If you double-checked that, by what criteria are you deciding that HALOBAT2 isn't running? I see no obvious problems in your code that would cause this.
Quote:
- Second, I get an "Invalid Dim" after the user and the enemy attack; the Goto takes me to the end of the code in HALOBAT2 where I tell it to run HALOBAT again if both guys are above 0 HP (is right on the colon before the "prgm" command).
That would suggest to me that L2 and L3 are empty or nonexistent for some reason. Can you verify their size and contents by printing them on the homescreen when this happens?

Also, some other tips:
:: You're using Stop because you're nesting your programs. Don't do that, use Return instead, because it's more shell-friendly (although Doors CS of course is smart enough to handle both). You can resolve the recursion through careful use of signal variables shared between HALOBAT and HALOBAT2, and looping in HALOBAT.
:: You can save quote a few bytes by writing 0→F:0→G:0→H:0→I:0→R as Delvar FDelvar GDelvar HDelvar IDelvarR.
:: You can optimize If F=93 and H≠92 and H≠93 and H≠94 and H≠82 and H≠83 into If F=93 and not(max(H={92,93,94,82,83
The weapon info is getting loaded properly. The reason why I don't think BAT2 is running is because it isn't showing if there's a miss/hit.

When I check L2/3, both have the info they should and are at 60 slots (as of now - left the extra room so I can mod it with less work).


So I should have a return that leads back into a return in the previous program (and keep doing it until I return out of the very first program)?

Okay - will change 0-> to DelVar. Wink

I will go learn not and max now so I can do that ('cause I don't want to use anything I don't know/understand). Razz

*EDIT* Should I move this to a "Your Projects" thread (and post the rest of my code)?
Warning: I haven't looked over your code very much at all, and will likely not look at it much more, or point out specific problems and solutions in your code.

Whenever I have a glitch like this in my programs, I use a simple trick to figure out what's causing it, and how to fix it. Keep asking "Why ___?"

So for in this case, you could ask, "Why is HALOBAT2 not running?"

HALOBAT2 apparently isn't running because it isn't reaching the call program code.

Why isn't it reaching the call program code?

Because the condition to be met to reach the call program code isn't being met as it should be.

Why isn't the condition to be met to reach the call program code being met as it should be?

And so on and so forth.

This simple trick can be applied to all sorts of problems, like in Engineering, Science, and the such, so be sure you know how to use it. It will save you much time trying to figure things out, and you'll be able to understand things like this better, by figuring it out on your own.
MufinMcFlufin wrote:
Warning: I haven't looked over your code very much at all, and will likely not look at it much more, or point out specific problems and solutions in your code.

Whenever I have a glitch like this in my programs, I use a simple trick to figure out what's causing it, and how to fix it. Keep asking "Why ___?"
And more specifically, I like to use things like Disp and Pause to narrow down what code exactly is running and what code never gets reached.

Beta7, let me know if you want me to explain not() and max() as I've used them, or to move this thread.
I do ask "Why_" a lot, but since the call program for BAT2 isn't waiting for any condition (no "indents" Wink ), I can't figure out why the code won't just keep going down the line and execute it.
Beta7 wrote:
I do ask "Why_" a lot, but since the call program for BAT2 isn't waiting for any condition (no "indents" Wink ), I can't figure out why the code won't just keep going down the line and execute it.
Try using Pause "REACHED BLAH" statements so you can trace where exactly things go awry.
I don't care where this is, so doesn't matter to me. But if "move" this thread, I should just make a new one so it isn't cluttred with all the previous questions.

And sorry for the double-post, but my phone is almost dead and can't take time to retype on other page. Confused

KermMartian wrote:
Beta7 wrote:
I do ask "Why_" a lot, but since the call program for BAT2 isn't waiting for any condition (no "indents" Wink ), I can't figure out why the code won't just keep going down the line and execute it.
Try using Pause "REACHED BLAH" statements so you can trace where exactly things go awry.


Okay - will go do that now. Wink

Didn't think anyone else would post before my double, so I guess you can disregard my apology - but insert it here. Razz
Fear not, I merged your posts for you. I agree that this should stay as a coding tips/debugging thread, and you should make a separate thread for your project information and updates.
Since I shan't double post (unless by accident) again, and no one said anything in my other topic, I decided to come here instead of making 1 post s WoT (more than most my posts already are Sad ).

I'm using tifreak8x's movement/collision detection program(s), and when I use the map strings that come with the program, all is fine. However, when I simply switch out the map strings with 9 of my own (and set up the correct variable set to order them), I get weird walking errors, such as not being able to walk into an open spot, but being able to walk through some "X"s (walls). I didn't change anything in the movement program, except which of 2 variables was the X map coord and which was the Y map coord (they aren't used outside of the 2 programs I switched them in). Any thoughts?


Thanks!
It sounds to me like whatever string is used for displaying the map is properly swapped out, but that whatever is handling the collisions is still operating on the old map. Can you check if the weird set of being able to walk places you shouldn't and not being able to walk places you should corresponds to the previous map displayed?
Silly me - the collision detection variable was set to start at spot 50 in the string, but I was starting everywhere BUT there. Razz

Now that that's resolved (and I feel quite stupid), I just have to get the event checker working (modded it from tifreak's matrix event checker, but it's acting up), and then I think I will be done (after I add stats to ingame menu and make a few more map sets).

Then I will work on modding this into one like what DJ Omnimaga suggested - but it will be after Halo 2.
Excellent, glad to hear you tracked down that particular bug. Smile Can you be more specific about how the matrix event checker is acting up so I/we can help you track down the issue?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 5
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement