Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: leafy on January 14, 2011, 02:12:07 am

Title: Button Press Routine
Post by: leafy on January 14, 2011, 02:12:07 am
I have this subroutine:

.BUTTONPRESS
Lbl BTN
For(I,1,{R})
I-1*5+1üJ
Text(88,56,{R+J+4}åDec)
If (({R+J+2}=1) and ({R+J}-S+1÷X) and ({R+J}+5ùX) and ({R+J+1}+3=Y)) or (({R+J+2}=4) and ({R+J}-S+1÷X) and ({R+J}+5ùX) and ({R+J+1}-S=Y)) and {R+J+4}
0ü{R+J+4}
{R+J+3}üF
1üG
Pt-Chan{R+J},{R+J+1},{R+J+2}-1*16+Pic4)
Pt-On({R+J},{R+J+1},{R+J+2}-1*2+1*8+Pic4)
End
End
Return

but 0 doesn't get stored into {R+J+4} for some reason. 'elp?
Title: Re: Button Press Routine
Post by: Builderboy on January 14, 2011, 02:25:45 am
without knowing the input into this routine and the states of the variables, the best i can say is that the If statement is never true, and so the 0 is never stored.  Try putting a text output inside the If statement and a pause to see if it is ever triggering.
Title: Re: Button Press Routine
Post by: leafy on January 14, 2011, 02:34:51 am
It's definetely triggered. I'll attach the compiled level for you to see. The button flickers since the Pt-Change keeps on occurring, but the text indicator at bottom right shows that it still stays at 1.
Title: Re: Button Press Routine
Post by: Builderboy on January 14, 2011, 02:40:55 am
Could it be that it is being triggered on the last itteration of the For loop, and so it never gets to display it?  Or could it be that you have a Fix 5 and it only displays the text after you dispGraph?
Title: Re: Button Press Routine
Post by: Runer112 on January 14, 2011, 02:41:58 am
Seeing as you attached an application, I would assume your problem is that R+J+4 points to a data area inside of your application. Applications exist in ROM (read-only memory), so you are unable to write data to it, only read from it. I would suggest either making your project a program or moving this data into a section of free RAM.
Title: Re: Button Press Routine
Post by: leafy on January 14, 2011, 02:37:21 pm
Okay, since my code is probably over the limit for Axe programs (not applications) since it gives me an Invalid error every time I ran it. So, I deleted all my text routines which were creating about 4000 bytes worth and tried it using a program instead. This time, when I run it the buttons depress normally and everything works except for when you die, after which the buttons stop working for some reason. I'll post my code later if you need to see it.