Author Topic: jBasic  (Read 28378 times)

0 Members and 1 Guest are viewing this topic.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #15 on: May 01, 2010, 11:35:09 am »
Actually i intend to add getkey() and randInt() and maybe more later. Im currently trying to figure out how to let you clear specific areas of the screen and i just might end up making each thing you draw have id's so you can do things with them without clearing the whole screen each time. I'll try my best to make it like TI-Basic, but there are going to be differences due to the object orietatedness (sp?) of JavaScript.
Hopefully it isnt too hard to pick up though.
I may make a XUL app to help you with it too. Who knows, this could be big :p
/e

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: jBasic
« Reply #16 on: May 01, 2010, 11:45:04 am »
an editor would be nice, so we dont have to use notepad, save, test, etc.

But yeah it's some nice stuff you have already. The cool thing is that those games can be played in a browser. I could easily embeed some into posts I think.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #17 on: May 01, 2010, 12:20:51 pm »
Yeah that was my thought :)
I'd also give you menu based addition of code, so it will give you a color selector and you enter all the other stuff and it would give you a preview of the element, then it would insert the code at the pointer in the text area. I would also give you the option of running the code withought saving. And when i get good enough maybe a visual designer...who knows :p
I have big plans for it right now :p
/e

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: jBasic
« Reply #18 on: May 01, 2010, 12:24:04 pm »
Nice :D

I also wonder if JS execution heavily depends of computer speed... on newer computers, would it be possible to setup timers to make sure code wont run too fast?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #19 on: May 01, 2010, 01:05:57 pm »
Well speed can be a problem, but yes you can set up timers :p setTimout("code",milliseconds) can be used to run something once setInterval("code",milliseconds) can be used to have it run every however milliseconds.

I have just made a randomInt() command. Click on the screen area in the demo to see it in action

randomInt(a,b);
Returns a random integer between two numbers.
a = the lower boundary
b = the upper boundary
/e

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: jBasic
« Reply #20 on: May 01, 2010, 04:15:29 pm »
ook nice to hear ^^

About speed my guess is that the timer would just need to be set at lower framerate

Btw I hope you are planning for cross browser compatibility?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #21 on: May 01, 2010, 04:35:32 pm »
actually, it measures its time based on the computers clock, so it will only have slowdown with the code running, but that probably shouldn't become a problem except on really slow computers.

actually it should work on all browsers that support JavaScript right now. I may run into problems with allowing people to make circles, but that will only be with browsers that don't support CSS5 (only FF and Webkit browsers support it right now) but I haven't tried to make them yet. Right now I'm focusing on figuring out how I'm going to let people delete specific objects on the screen but in a way that makes it seem like it is TI-Basic...
/e

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: jBasic
« Reply #22 on: May 01, 2010, 04:46:34 pm »
Aaaah I see. Good luck!
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #23 on: May 01, 2010, 05:02:38 pm »
thanks!

ok, I've added a way to delete objects, currently it will return the pointer to the object that you draw, so all you have to do is:
Code: [Select]
objectPointer = Line(0,0,100,200,10,"black");
pixelOff(objectPointer);
to remember the object and to delete it :) simple as that :)
I've updated the demo with the commands.
New commands:

pixelOff(pointer);
deletes an object on the screen
pointer = a variable pointing to the object. You can save variables to objects by adding a
Code: [Select]
objectPointerName =before each object you draw that you want to be able to delete.

screenOff();
Makes the screen and all its contents invisible.

screenOn();
Makes the screen and all it's contents visible.

EDIT: just aded the circle command, so this only works on FF, and webkit browsers, but as soon as CSS5 becomes standard, this will still work :D

circle(x,y,radius,color);
draws a circle on the screen.
x = the x location of the top left corner of the circle in pixels
y =  the y location of the top left corner of the circle in pixels
radius = the radius of the circle in pixels (half the width)
color = the color of the circle. Can be hex or colorname.
« Last Edit: May 01, 2010, 05:20:47 pm by Eeems »
/e

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: jBasic
« Reply #24 on: May 01, 2010, 05:22:56 pm »
i need to start messing around with this when I get some time. I assume there'll also be the control commands, right? (if/else/endif/while/repeat/etc)
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #25 on: May 01, 2010, 05:34:26 pm »
well if/else/endif/while are all the built in javascript ones. This is because I have no idea how to make them from scratch x.x
I'm going to add in keycontrol commands soon.

New Commands:
object(type,css,html,x,y);
creates an object on the screen, good for prebuilt characters and such.

type = the tag name. Must be a string. eg: 'div' or 'span'.
css = the css of the object. Note that position is changed to absolute and that top/left are changed to y/x respectively.
html = the innerHTML of the object, must be a string.
x = the x location of the top left corner in pixels
y = the y location of the top left corner in pixels

getkey();
returns the most recent key to be pressed is returned in string form. the command is not completed yet.
« Last Edit: May 01, 2010, 05:43:03 pm by Eeems »
/e

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: jBasic
« Reply #26 on: May 01, 2010, 05:42:04 pm »
i am confused by what you mean by character, do you mean char sprites or text?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #27 on: May 01, 2010, 06:34:38 pm »
I mean like animated characters and such, things that you built using HTML and you want to just include that.

also, getKey() doesn't work...but I'm working on it.
/e

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: jBasic
« Reply #28 on: May 01, 2010, 06:58:30 pm »
ooh ok I see but what's the link between HTML and animated chars? Do you mean for example displaying an animated gif with <img>?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #29 on: May 01, 2010, 07:01:27 pm »
well that and if you have a pre-designed character built with html (using tables and such) then you can use this to add them.
ok, GetKey() and getKeyCode() works now :D they require the addition of
Code: [Select]
<form name="keyform">
  <input id="getkey" style="visibility:hidden;" readonly="readonly" type="text" value=""></input>
  <input id="getkeycode" style="visibility:hidden;" readonly="readonly" type="text" value=""></input>
</form>
between the <body> tags

try pressing the arrow keys in the demo :P
« Last Edit: May 01, 2010, 07:07:04 pm by Eeems »
/e