Author Topic: Why FreeBASIC rocks your socks.  (Read 18333 times)

0 Members and 1 Guest are viewing this topic.

Offline coolsnake

  • LV2 Member (Next: 40)
  • **
  • Posts: 36
  • Rating: +2/-0
    • View Profile
Re: Why FreeBASIC rocks your socks.
« Reply #30 on: September 04, 2010, 09:01:31 am »
For those who want a jumpstart on how to use FreeBASIC:
http://www.freebasic.net/wiki/wikka.php?wakka=TutGettingStartedQB
http://www.freebasic.net/wiki/wikka.php?wakka=TutHowToProgGame1

I only read those two to make my port from TI-Basic to Freebasic.
The first link shows how to output text, draw lines,draw circles, rectangles.
The second one is more interesting. It shows you how to create a game loop by moving a circle.
It'll introduce you to FB's "GetKey", "ClrHome", loops and the declaration of variables.
They don't take long to read either, it's great!

Look at this page to get a quick peek at all the commands:
http://www.freebasic.net/wiki/wikka.php?wakka=CatPgFullIndex

Hmm, some of it reminds me Casio calculators...

If it's similar to TI-BASIC and Casio BASIC, maybe I could learn it easily :)

Well that's the beauty of it. It may not have the exactly same syntax but It certainly does "feel" like TI-Basic.
I'm really developing to become a FreeBASIC fanboy now.  :P
You could also "setup" FreeBASIC to behave alot more like TI-Basic on the calculator.
Here's a quick tutorial:
NOTE: You can get alot of this out of the previously mentioned tutorials too.

If you add the following line to the top of your FreeBASIC source, you get a 16x8 character screen like the one on your calc.
Code: [Select]
screenres 136,72
If you add these lines to the top you can use the very responsive GetKey from FB(there's also a slower one):
Code: [Select]
   #include "fbgfx.bi"
    Using FB

The very responsive GetKey works just like in Axe
Code: [Select]
MultiKey(SC_KEY)
If you want to use certain variables you have to declare them.
You're probably not used to this in TI-Basic but it's standard fare in computer languages.
Code: [Select]
DIM as integer A,B,C
DIM as string Str1,Str2
It's pretty straightforward. Here's a link to the datatypes.
http://www.freebasic.net/wiki/wikka.php?wakka=CatPgStdDataTypes

If you want to store variables:
Code: [Select]
A=10
str1="abc"

The pause command in TI-Basic becomes
Code: [Select]
Sleep
If you want to pause for 100 milliseconds
Code: [Select]
Sleep 100,1If you don't add the ",1" it'll wait for 100 milliseconds OR until a key is pressed. the ",1" disables the latter.

ClrHome becomes
Code: [Select]
Cls
If your hesistant about using FB's syntax and rather want to use TI-Basic's syntax, you can just add a subroutine to the beginning of your code.
e.g for ClrHome

Code: [Select]
Sub ClrHome
cls
End sub

And now you can use ClrHome in the same way you use it as in TI-Basic! :D
i'm going to go out on a limb here and say that you can do this for about every TI-Basic command except:
-the (unconventional) storage of variables e.g 10-> B
-Conditionals
-Loops

Here's a subroutine to use the Output command.
Note that I use output1(Y,X,"text") instead of output(Y,X,"text") because there already is a (different) function called output in FB, so I can't just replace it with mine.
Code: [Select]
sub output1(Y as integer,X as integer,text as string)
locate Y,X
print text
end sub

Also be aware that FB is certainly not limited to the stuff I'm showing you.
Check FB's projects page to see what FB is capable of.
http://www.freebasic.net/forum/viewforum.php?f=8
I kinda smirked at the gameboy emulator thing.
*imagines writing a gameboy emulator in TI-Basic ;D*
« Last Edit: September 04, 2010, 09:05:18 am by coolsnake »
Unpretty Integrals
This program gives you a graphical representation of the "fnint(" function, which allows you to calculate definite integrals. It is extremely similar to the functionality MathPrint provides, minus the extreme bloat that slows your calculator down to a crawl.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Why FreeBASIC rocks your socks.
« Reply #31 on: September 04, 2010, 05:54:15 pm »
Nice. I'm really glad there's a TI-BASIC like computer language. I tried VB and C before and I just don't like it. Same for TI-Nspire/89 BASIC, although not as much. I prefer syntaxes like TI-83+ BASIC or Axe. Also I'm glad it is not just limited to text games.
« Last Edit: September 04, 2010, 05:58:20 pm by DJ Omnimaga »
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Why FreeBASIC rocks your socks.
« Reply #32 on: September 04, 2010, 07:03:46 pm »
Very cool. I'll add that to my Tutorials page.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Why FreeBASIC rocks your socks.
« Reply #33 on: September 04, 2010, 10:23:14 pm »
If your hesistant about using FB's syntax and rather want to use TI-Basic's syntax, you can just add a subroutine to the beginning of your code.
e.g for ClrHome

Code: [Select]
Sub ClrHome
cls
End sub

And now you can use ClrHome in the same way you use it as in TI-Basic! :D
i'm going to go out on a limb here and say that you can do this for about every TI-Basic command except:
-the (unconventional) storage of variables e.g 10-> B
-Conditionals
-Loops

Wow, that's a really useful feature. We should keep track of the particularly useful replacements and post it somewhere...




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Why FreeBASIC rocks your socks.
« Reply #34 on: September 04, 2010, 10:25:58 pm »
Ok so if we call a command that is not the name of any FreeBASIC command or name used, it will interpret it as an actual sub-routine? Seems kinda nice. Someone could easily write a set of sub-routines that lets someone use pretty much all game programming TI-BASIC commands.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Why FreeBASIC rocks your socks.
« Reply #35 on: September 04, 2010, 10:53:55 pm »
Hm, I wonder if FreeBASIC could be changed a bit (meaning the source itself so that it would run TI-BASIC programs perfectly. That would be easier than using an emu!




Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Why FreeBASIC rocks your socks.
« Reply #36 on: September 04, 2010, 10:56:26 pm »
That would be hella awesome :D Or maybe a crossover language for people who know calc programing but want to move onto computer programing

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Why FreeBASIC rocks your socks.
« Reply #37 on: September 04, 2010, 10:57:48 pm »
Well isn't that essentially what Miotatsu is doing with BasiC++?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Why FreeBASIC rocks your socks.
« Reply #38 on: September 04, 2010, 11:53:57 pm »
And I think there was a topic somewhere around here about making an online calc simulator ... what about just a simple TI-BASIC emulator? It would be really helpful to people without an emu on their computer.




Offline coolsnake

  • LV2 Member (Next: 40)
  • **
  • Posts: 36
  • Rating: +2/-0
    • View Profile
Re: Why FreeBASIC rocks your socks.
« Reply #39 on: September 05, 2010, 02:09:41 pm »
I've been browsing FB's site for a bit and I think I might be able to create a library for FB. Concretely it means you just need to add two files to the FreeBasic lib directory, add two lines of code to the start of your source code, and presto, pseudo TI Basic.  :P
I do consider this a "hackish" attempt though, since it's just mainly renaming known functions. But meh, I've never written a library before and it sounds fun.   :D

Hm, I wonder if FreeBASIC could be changed a bit (meaning the source itself so that it would run TI-BASIC programs perfectly. That would be easier than using an emu!

Well FreeBASIC is opensource... But I doubt it would be that easy.^^ It's mainly there so people can use new but potentially unstable versions.
Unpretty Integrals
This program gives you a graphical representation of the "fnint(" function, which allows you to calculate definite integrals. It is extremely similar to the functionality MathPrint provides, minus the extreme bloat that slows your calculator down to a crawl.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Why FreeBASIC rocks your socks.
« Reply #40 on: September 05, 2010, 02:14:34 pm »
One other question about FreeBASIC: if you want people to be able to play your game, do they absolutely need to install FreeBASIC or can you make them standalone executables like Visual Basic and RPG Maker (in the latter, you needed to use an undocumented trick to remove dependencies, though)?
« Last Edit: September 05, 2010, 02:14:46 pm by DJ Omnimaga »
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline coolsnake

  • LV2 Member (Next: 40)
  • **
  • Posts: 36
  • Rating: +2/-0
    • View Profile
Re: Why FreeBASIC rocks your socks.
« Reply #41 on: September 05, 2010, 03:16:01 pm »
Don't worry, it compiles to standalone executables. Dependencies are a turnoff in general  :P
Unpretty Integrals
This program gives you a graphical representation of the "fnint(" function, which allows you to calculate definite integrals. It is extremely similar to the functionality MathPrint provides, minus the extreme bloat that slows your calculator down to a crawl.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Why FreeBASIC rocks your socks.
« Reply #42 on: September 06, 2010, 04:01:01 pm »
Ok good. With one of my old VB games, I discovered it requires me to download some OCX files to play them and it won't tell me where to put them (in the system folders it doesn't work in Windows 7 64 bit)
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Why FreeBASIC rocks your socks.
« Reply #43 on: September 06, 2010, 07:32:25 pm »
is this for the nspire?
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Why FreeBASIC rocks your socks.
« Reply #44 on: September 06, 2010, 09:28:26 pm »
Sadly, no. It's a computer program (definitely Windows, Idk about Linux or Mac OS)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.