Author Topic: What's wrong with this code ?  (Read 18890 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: What's wrong with this code ?
« Reply #15 on: February 18, 2013, 07:57:55 am »
Yep, if Grammer isn't installed and you try to run the program, it will be run as a BASIC program, so it exits. If it is run as a Grammer program, the first "." tells it that it is a label, so it skips the line.


And here is the code:
Code: [Select]
:.0:Return
:31→Y
:47→X
:0→L
:30→M
:1→P
:ClrDraw
:While Y=abs(Y
:Line(0,59,5,96,1
:randInt(0,86
:Line(,59,5,12,2
:1→F
:For(A,1,M
:getKey→K
:If K=10
:Full
:If K=11
:Full0
:K=3
:-K=2
:+Ans+X
:If <86: and !Line(Ans,Y,6,6,15
:→X
:If Y<52: and !Line(X,Y+6,1,6,14
:IS>(Y
:Repeat 1
:Return→Z
:Line(X,Y+1,4,6,2
:Line(X+1,Y,6,4,2
:End
:DispGraph
:prgmZ
:If P xor 1→P
:Tangent(1,8:Y-!!Line(X,Y,7,6,15→Y
:End
:If L+1→L=5: and M>14
:Then
:0→L
:M-1→M/30
:If θ': and P>0
:P-1→P
:End
:End
:Stop

Offline blg_flg

  • LV0 Newcomer (Next: 5)
  • Posts: 3
  • Rating: +0/-0
    • View Profile
Re: What's wrong with this code ?
« Reply #16 on: February 18, 2013, 10:36:14 am »
Ok. Thank you very much! :) But what's the prgmZ?

Edit: Ah ok the hooks were not activated... --'
« Last Edit: February 18, 2013, 11:26:58 am by blg_flg »
I'm French! Don't hesitate to correct my spelling mistakes; I would be pretty happy! ;)

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: What's wrong with this code ?
« Reply #17 on: February 18, 2013, 11:14:34 am »
Xeda has not activated his hooks.

"prgm" is "call", so, it means "call Z"


Spoiler For Take a look at the wonderful humor of Adriweb:
(17:17:08) Adriweb: Yes, Xeda is not a hooker.
(17:17:13) Adriweb: that's it.
(17:17:13) Adriweb runs very far......
« Last Edit: February 18, 2013, 11:21:06 am by persalteas »


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: What's wrong with this code ?
« Reply #18 on: February 18, 2013, 12:47:52 pm »
Yes, sorry, I always forget to activate the token hook XD 'prgm' turns into 'call '

Also, very funny Adriweb >.> :P

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: What's wrong with this code ?
« Reply #19 on: February 19, 2013, 12:10:08 pm »
Quote
:If <86: and !Line(Ans,Y,6,6,15

By this, do you mean "If Ans=/=0 and Ans<86:Line(Ans,etc..." ?


Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: What's wrong with this code ?
« Reply #20 on: February 19, 2013, 01:01:32 pm »
Quote
:If <86: and !Line(Ans,Y,6,6,15

By this, do you mean "If Ans=/=0 and Ans<86:Line(Ans,etc..." ?
The "If <86" part would translate to TI-BASIC as:
Code: [Select]
If Ans<86 and Ans≥0Then Line(Ans,Y,6,6,15 is used to pixel-test the rectangular region, so !Line(Ans,Y,6,6,15 means in TI-BASIC:
Code: [Select]
not(Line(Ans,Y,6,6,15    ;pretend this still pixel tests the region
Remember that ':' can be used in an If statement to separate different parts. So the line translates to:
Code: [Select]
:If (Ans<86 and Ans≥0) and not(Line(Ans,Y,6,6,15

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: What's wrong with this code ?
« Reply #21 on: February 19, 2013, 01:16:06 pm »
Oh. yes.

I have forgotten that Line could have a pixel-test role. (cf my question in Grammer 3 ideas).

Thanks.


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: What's wrong with this code ?
« Reply #22 on: February 20, 2013, 04:48:40 pm »
I still would like to at some point, but I don't know when I would do that .__. Also, welcome blg_flg :D The code wasn't that bad. At least it worked when the bugs were fixed :)
It probably depends of how large grammer is in terms of flash app page memory taken. If it fills an entire page (16 KB), then it might be fine (leaving 11 KB to the user), but if it takes 2 pages, the 82 Stats/83 only has 27 KB of memory.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: What's wrong with this code ?
« Reply #23 on: February 20, 2013, 08:39:50 pm »
I was thinking about it this morning and I would probably make a version that didn't have as many features. It would still have many more features than Grammer 1, but it would probably be about 6000 bytes and use more OS routines. Currently, Grammer uses mostly custom routines to make things faster, so if I used OS routines, I could probably save about 1000 bytes of code :) Also, I have optimised many routines to be even faster than the Grammer 1 routines (and smaller) so that should help.

Offline persalteas

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 231
  • Rating: +44/-4
  • z80 poweeer
    • View Profile
    • Tout-82
Re: What's wrong with this code ?
« Reply #24 on: February 21, 2013, 04:47:10 am »
That's a very good news ;)
even if it has less features, it will be very appreciated, for now, there is no intermediary between Basic and Asm on TI-83s...


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: What's wrong with this code ?
« Reply #25 on: February 21, 2013, 09:15:16 am »
Cool to hear. Just make sure that the most used features are still there and it should be fine. And I agree Persalteas. Also if someone make Grammer programs for the TI-83 maybe he could read them on a 83+ too, since you can send 83p files to them as well.