Author Topic: Button Press Routine  (Read 4575 times)

0 Members and 1 Guest are viewing this topic.

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Button Press Routine
« 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?
In-progress: Graviter (...)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Button Press Routine
« Reply #1 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.

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Button Press Routine
« Reply #2 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.
In-progress: Graviter (...)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Button Press Routine
« Reply #3 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?

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Button Press Routine
« Reply #4 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.

Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Button Press Routine
« Reply #5 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.
In-progress: Graviter (...)