Author Topic: BatLib  (Read 145634 times)

0 Members and 1 Guest are viewing this topic.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib
« Reply #270 on: April 06, 2011, 12:26:46 pm »
I just started learning BatLib Basic and loved it (when I read the pdf) and now found an error, I guess:

Code: [Select]
dim(22,"EF0745
Prompt A

It prompts for var A, but the screen is not cleared :S

And I run this:

I just started learning BatLib Basic and loved it (when I read the pdf) and now found an error, I guess:

Code: [Select]
dim(22,"EF0745

It'll print EF075.

Any idea of what I'm doing wrong? Thanks.

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BatLib
« Reply #271 on: April 06, 2011, 04:40:29 pm »
The hex code to clear the LCD is EF4045 :P
All that does is clear the LCD, but when displaying the homescreen, it will reload the contents from the buffer
EF0745 displays the current contents of HL, but if you run it from the homescreen, the string is displayed, overwriting the value. So, in a program you can do:
Code: [Select]
dim(22,"EF0745
Pause
That being said, I have been bugged about this, too, but since I wasn't sure if anybody else would be, I decided to leave it this way. It will only take 4 more bytes of code, but I can prevent dim(22 and dim(23 from modifying Ans. Are there any other commands that should not modify Ans?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib
« Reply #272 on: April 06, 2011, 04:42:03 pm »
Code: [Select]
dim(22,"EF4045
Pause A

I got ARG Error (TI-Basic error) :S

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BatLib
« Reply #273 on: April 06, 2011, 04:43:50 pm »
That worked fine for me... I just tested it. Is that the only code?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib
« Reply #274 on: April 06, 2011, 04:48:40 pm »
I had to reparse hooks, it worked, but it displays a 5 in the right part of the screen :S

OH WAIT, that's the variable A
« Last Edit: April 06, 2011, 04:49:01 pm by Scout »

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BatLib
« Reply #275 on: April 06, 2011, 04:49:20 pm »
Might I ask what the value for A is XD
EDIT: Never mind :P

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib
« Reply #276 on: April 06, 2011, 04:56:23 pm »
Might I ask what the value for A is XD
EDIT: Never mind :P

Now I want to know if when I create a rectangle, I need to dim(99) to see it. Thanks.

I tried this:

Code: [Select]
ClrDraw
ClrHome
dim(29,0,30,0,30
dim(99

And got no success.

Wait, I didn't put a type, 1 for black worked :D

EDIT:
My first cool thing:
Code: [Select]
dim(2
dim(22,"FDCB00AE
dim(22,"EF4045
dim(29,0,96,0,64,1
dim(99
Pause
:D
« Last Edit: April 06, 2011, 05:06:42 pm by Scout »

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BatLib
« Reply #277 on: April 06, 2011, 05:05:12 pm »
Cool! I love the rectangles ♥ Um, my most common error is that I forget to add a type. But anywho, I want to give you an optimisation trick that might be tough to grasp:
Code: [Select]
dim(29,0,8,0,8,2      ;makes an inverted 8x8 rectangle at (0,0)
dim(99                ;Displays the graph screen
dim(10,67             ;This waits for a key press in the arrows, Enter through Clear, and Graph through Y=, and 2nd to Del
dim(43→A              ;This returns a key press that detects up to 2 keys
dim(29,0,8,0,8,2      ;makes an inverted 8x8 rectangle at (0,0)
However, if you want to speed up the code a little as well save memory, you can combine all of the syntaxes:
Code: [Select]
dim(29,0,8,0,8,2,99,10,67,43,29,0,8,0,8,2→A
Both of those will invert a rectangle, display the graph, wait for a keypress, reinvert the rectangle, and then store the keypress to A
The optimised method might be more difficult to read later, though :D

EDIT: Hehe, that is the same mistake I make most often :D By leaving off the 1, it was read as 0, so it cleared the rectangle XD

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib
« Reply #278 on: April 06, 2011, 05:10:16 pm »
Niiice Xeda, thanks :D

Code: [Select]
dim(2
dim(22,"FDCB00AE
dim(22,"EF4045
dim(29,0,96,0,64,1
dim(99
Pause

As I said, this code is OK, but closing it is hard and the screen isn't cleared in the end. Any idea?

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BatLib
« Reply #279 on: April 06, 2011, 05:15:40 pm »
The hex code to clear the LCD is EF4045 :P
All that does is clear the LCD, but when displaying the homescreen, it will reload the contents from the buffer
You need to clear the textShadow buffer, too, so you can use EF4645. So, dim(22,"FDCB00AEEF4645

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib
« Reply #280 on: April 06, 2011, 05:25:24 pm »
Ah thanks much :D

HELLO WORLD:

Code: [Select]
AxesOff
ClrDraw
dim(87,5,5,"HELLO WORLD
dim(99

It's a very ugly Hello World though.

Actually, what I get is:

HELLO)WORLD
                   99

In the screen, the ')' and the 99 are weird :S

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BatLib
« Reply #281 on: April 06, 2011, 05:27:32 pm »
Hehe, that is because that displays ASCII data :P Check command 90 :D

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib
« Reply #282 on: April 06, 2011, 05:28:41 pm »
No ')' but I still get a 99 :S

Offline Xeda112358

  • they/them
  • Project Author
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: BatLib
« Reply #283 on: April 06, 2011, 05:30:50 pm »
That is because it doesn't actually tell the calc you are looking at the graph screen, it just displays it, even if you are on the homescreen. Try putting a pause there :)

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib
« Reply #284 on: April 06, 2011, 05:32:09 pm »
Perfect, I put the coordenates as (5,5) but it appears quite far from (5,5). It looks like 5,20. (I'm always talking in (Y,X)).