Author Topic: BatLib/ReCode Examples  (Read 26117 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/ReCode Examples
« Reply #15 on: April 10, 2011, 07:15:54 pm »
I made a new Example for you coders!

Code:
Code: [Select]
dim(1,56,4,22,"FDCB00AEC9"       ;Disables run indicator, clears screen and disables done message
0->A
While A!=45                                      ;Until pressing [CLEAR]
AxesOff
For(I,0,96
AxesOff
dim(56,12,I,99                                   ;Draws vertical lines
I+1->I
End
DispGraph
getKey->A
End

Screenshot:


Notes:
The dim(56 command is one of the best commands to use for graph screen management and it's very important you dominate it well.
dim(56,4 will clear the screen and set axes to off, just like Fill(0 in a ReCode block.

Yet again, if you have any questions on this, reply!
« Last Edit: April 10, 2011, 07:18:45 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/ReCode Examples
« Reply #16 on: April 10, 2011, 09:21:32 pm »
I have to say, I love this idea, Scout! I wish I could think of graphics like this, but really, keep up the good work! Also, because I like to optimise things:
Code: [Select]
dim(1,56,4,22,"FDCB00AE        ;Disables run indicator, clears screen and disables done message
Repeat getKey=45               ;Until pressing [CLEAR]
For(I,0,94,2
dim(56,12,I,99                 ;Draws vertical lines
End
End

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib/ReCode Examples
« Reply #17 on: April 11, 2011, 04:59:20 am »
I was beat (in optimization) by Zeda :P

I guess my next program may not be an example, but a demo, but I need ideas :P

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib/ReCode Examples
« Reply #18 on: April 11, 2011, 08:32:05 am »
New Example!

This is a ReCode example but that could be made using BatLib and Basic and would probably be faster and smaller, but I wanted to show you another ReCode sample guys.

Code: [Select]
dim(1,56,4,22,"FDCB00AE",40
0->I
While getKey!=15
Shade(I
I+1->I
If I>39
0->I
Pause 5
End
Shade(24
Stop

First of all, it disables run indicator, clears the screen and disables "Done Message".

Then it goes through a loop of Shade(. In the end it sets Shade(24 to make it back to what's more or less normal.

Screenshot:


What do you think? Attached is SHADEBAC.8xp :)
« Last Edit: April 11, 2011, 08:35:46 am 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/ReCode Examples
« Reply #19 on: April 11, 2011, 08:54:55 am »
Aw, it's too bad the shading doesn't work x.x To be honest, I completely forgot about the Shade( command in ReCode XD

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib/ReCode Examples
« Reply #20 on: April 11, 2011, 09:07:30 am »
Aw, it's too bad the shading doesn't work x.x To be honest, I completely forgot about the Shade( command in ReCode XD

It works, if you try it on WabbitEmu or in your calc, it works, the GIF Recording just doesn't get it.

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/ReCode Examples
« Reply #21 on: April 11, 2011, 08:46:22 pm »
Yeah, that's what I meant to say ;D I hope that works someday, but I think I see the reason for why it doesn't record the contrast... the .gif files would get pretty large :/

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib/ReCode Examples
« Reply #22 on: April 12, 2011, 02:24:51 pm »
Yeah, that's what I meant to say ;D I hope that works someday, but I think I see the reason for why it doesn't record the contrast... the .gif files would get pretty large :/

I made a new shade sample, but this one won't get to Shade(40 and then go back to Shade(1. Instead, it does something like this:

So, since the lightness GIF recording with WabbitEmu doesn't work, I'll just paste the code:

Code: [Select]
dim(56,4,1,22,"FDCB00AE",40
0->I->A
While getKey!=15
If I>40
0->A
If I<1
1->A
Shade(I
If A=1
I+1->I
If A=0
I-1->I
DispGraph
End
Shade(24
Stop

Attached is the file, like it? Any optimizations?

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/ReCode Examples
« Reply #23 on: April 12, 2011, 04:04:09 pm »
This is my version... I added a Pause because it was a little fast XD
Code: [Select]
dim(1,22,"FDCB00AE",40
FullFill(0→I                        clears the screen and puts it at 6MHz
DispGraph
1→A
While getKey!=15
I+A→I
If I>40
0→I -A→A
If I>39                 ;this is because I will never be >40 unless negative
39→I -A→A
Shade(I
Pause 3
End
Shade(24
Stop

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib/ReCode Examples
« Reply #24 on: April 12, 2011, 04:05:38 pm »
This is my version... I added a Pause because it was a little fast XD
Code: [Select]
dim(1,22,"FDCB00AE",40
FullFill(0→I                        clears the screen and puts it at 6MHz
DispGraph
1→A
While getKey!=15
I+A→I
If I>40
0→I -A→A
If I>39                 ;this is because I will never be >40 unless negative
39→I -A→A
Shade(I
Pause 3
End
Shade(24
Stop

Hum, isn't the calculator 6Mhz all the time?

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/ReCode Examples
« Reply #25 on: April 12, 2011, 04:08:29 pm »
Not if you have one that can do 15MHz. ReCode starts out at the max speed :) Should I change that?

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib/ReCode Examples
« Reply #26 on: April 12, 2011, 04:09:43 pm »
Not if you have one that can do 15MHz. ReCode starts out at the max speed :) Should I change that?

It does? I had no idea. I think you should, but just my opinion. Perhaps a poll?

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/ReCode Examples
« Reply #27 on: April 12, 2011, 04:10:55 pm »
Yes, good idea! I will add a poll to BatLib Ideas!

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: BatLib/ReCode Examples
« Reply #28 on: April 13, 2011, 04:19:50 am »
Yes, good idea! I will add a poll to BatLib Ideas!

I see you added it already, I could make some neat animations with it.

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/ReCode Examples
« Reply #29 on: April 20, 2011, 09:30:00 pm »
Okay, so in this example, I wanted to show off how you can use BatLib to read lists. For example, say you have a game and you store the save files to lists. You can have the user input the name of the "save file" and you can use BatLib to read it :)

Code: [Select]
ClrHome
Input "FILE NAME:",Str1
dim(38,9,"L"+Str1             ;This is the little l for custom lists
Pause Ans
That code is very simple and takes advantage of the fact that if the list doesn't exist, ".BAD NAME" is output.