View previous topic :: View next topic |
Author |
Message |
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sun Jul 02, 2006 7:44 pm Post subject: Javascript VDS interpreter |
|
|
Just because I was bored, I created a little javascript interpreter which can execute VDS code in about every web browser. For now, only 4 of 5 functions are implemented, but I can add more in just a few hours. The same counts for commands. To control the flow of a script, labels, goto/gosub, exit/stop, if-elsif-else-end, while-wend and repeat-until commands can be used.
If I continue to develop this, would you guys think I can publish it at VDSWORLD or should I keep it private?
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Jul 04, 2006 6:46 am Post subject: |
|
|
Be sure to check with Emmanuel about this first.
-Garrett
|
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
PGWARE Web Host
Joined: 29 Dec 2001 Posts: 1563
|
Posted: Wed Jul 05, 2006 5:25 am Post subject: |
|
|
I would think it would be a nice addition to vds, simply because VDS can now be used 'cross platform' via the internet.
|
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Sat Jul 08, 2006 5:42 pm Post subject: |
|
|
I agree with PG. Looking forward to seeing what it can do.
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sun Jul 09, 2006 9:30 am Post subject: |
|
|
You can download the ZIP file which comes with this post to get the (compressed) VDS interpreter. The only difference with VDS is that ALL variables start with a single %, even if you use long variable names. I don't know if I'm going to change that, but I thought it would be a little better this way Also, you can use any list name you want instead of only 1 to 40 or so.
Code: | Supported functions
-------------------
@fadd(<number>, <number>)
@ask(<text>)
@count(<list>)
@diff(<number>, <number>)
@equal(<value>, <value>)
@input(<text>, <default value>)
@item(<list>, <index number>)
@text(<list>)
@unequal(<value>, <value>)
Supported commands
------------------
exit
info <text>
gosub <label>
goto <label>
if <statement>
elsif <statement>
else
end
list create, <list>
list close, <list>
list add, <list>, <value>
stop
while <statement>
wend
repeat
until <statement> |
Two examples are included, one which you can use for debugging or which can work together with javascript, and one which can use <script type="Visual Dialogscript"> HTML tags.
The interpreter might be a little slow, but the javascript code could be converted to real java bytecode which speeds things up a lot!
Description: |
|
Download |
Filename: |
interpreter.zip |
Filesize: |
4.31 KB |
Downloaded: |
2608 Time(s) |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Mon Jul 10, 2006 6:27 pm Post subject: |
|
|
very cool! just playing with it, it has a lot of potential. Keep it going!
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Jul 16, 2006 2:27 pm Post subject: |
|
|
Hey, that's cool!! I like it, keep working on it
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
vdsalchemist Admin Team
Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Mon Jul 24, 2006 3:33 pm Post subject: |
|
|
Hi All,
I think it is very cool. I have tried it and it works pretty good. It still has some maturing to do before it is a viable alternative. I have discussed this with Skit and I am looking forward to the new commands/functions he is currently working on Keep up the good work Skit.
_________________ Home of
Give VDS a new purpose!
|
|
Back to top |
|
|
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Jul 24, 2006 8:15 pm Post subject: |
|
|
Becareful guys. I know Skit has mentioned this to ED, but ED I guess
didn't really say anything in reply to this. But that doesn't mean he
approves or disapproves. I'd still recommend that you keep this among
a closed group here until you do finallly get some sort of final response
from ED on it.
-Garrett
|
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sun Oct 22, 2006 12:19 pm Post subject: |
|
|
A little while ago, I lost the sourcecode of this project. I decompiled the compressed version which came with this post and am posting it as an attachment to this post, to prevent myself from loosing it AGAIN...
I do not have much spare time, but I am planning to add more functions to this script. Also, I want to make it possible to run it on three ways: on a server, in a webbrowser and as standalone on client PCs. This way, you can run one script on every thinkable platform without needing to change it. But like I said, I don't know when I have some time to work on this.
I do have tested this code on Windows, Linux ánd Novell NetWare machines. Only for specified actions like file handling and creating dialogs, each platform has its own methods which need to be implemented one by one.
Description: |
|
Download |
Filename: |
interpreter.zip |
Filesize: |
5.99 KB |
Downloaded: |
2534 Time(s) |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Thu Oct 26, 2006 7:14 pm Post subject: |
|
|
New update, this is what I got so far. I still have to do a little more input checking (like "is parameter 1 for function @sum() really an integer?") and maybe some functions don't act exactly like their VDS equivalents.
Functions
Code: | Conditional
Done:
- both
- equal
- greater
- not
- null
- numeric
- unequal
- zero
Maths
Done:
- abs
- diff
- div
- fadd
- fdiv
- fmul
- fsub
- pred
- prod
- succ
- sum
Todo:
- fabs
- fatn
- fcos
- fexp
- fint
- fln
- format
- frac
- fsin
- fsqt
- hex
- mod
- random
Windows
Done:
- ask
- input
- query
- msgbox
Lists
Done:
- count
- item
- text
- match
Strings
Done:
- asc
- chr
- cr
- len
- lf
- lower
- pos
- strins
- substr
- trim
- upper
Todo:
- fill
- strdel
Default
Done:
- error handling
Todo:
- datetime |
Functions
Code: | Lists
Done:
- list add
- list create
- list clear
- list close
- list delete NOTE: slightly different from VDS version
- list insert NOTE: same function as "list put"
- list put NOTE: slightly different from VDS version
Todo:
- list append
- list assign
Windows
Done:
- info
Todo:
- dialog
- warn
Script execution
Done:
- exit
- gosub
- goto
- stop
Todo:
- error
- option
- timer
- (wait [event])
Conditional
Done:
- if
- elsif
- else
- end
Loops
Done:
- repeat
- until
- while
- wend
Default
Done:
- error handling |
Please note that lists DO NOT use "@index" and "list seek". I might add it when I start working on the "dialog" commands, but until that day I think it is only confusing to use an index if it isn't even visible.
Another feature added, is that you can use as much parameters as you like with some maths functions like "@fadd" and "@diff". The same goes for "@both".
Description: |
|
Download |
Filename: |
Interpreter.zip |
Filesize: |
8.05 KB |
Downloaded: |
2503 Time(s) |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Thu Oct 26, 2006 8:25 pm Post subject: |
|
|
Very nice.. Looking forward to more additions!! Keep up the great work!
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
Skit3000 Admin Team
Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Oct 28, 2006 3:25 pm Post subject: |
|
|
I guess I have a little too much free time this weekend.
New addition to the interpreter script: the D of VDS is now supported! You can create dialogs just like how you would do it with VDS itself. Please note that due to the usage of this script in a browser window, closing a window by pressing the red X will close it right away, even before the :Close label is called. Also, styles are not supported yet.
The ZIP file with this post comes with an example of a few basic functions you can perform with the interpreter. If you want to see how to use multiple dialogs, try the code below
Code: | dialog create,Test 1,10,10,200,300
dialog add,button,button1,10,10,180,280,Close me
dialog create,Test 2,10,244,200,300
dialog add,button,button2,10,10,180,280,Close me
:Evloop
wait event
goto @event()
:Button1button
dialog select,1
dialog close
goto Evloop
:Button2button
dialog select,2
dialog close
goto Evloop
:Close
goto Evloop |
Note that the "dialog show" command is not used. This is because of a javascript limitation. On the other hand, this gives the ability to use the current browser window as a "host" for a VDS dialog. That way, you can add elements to the browser window in which the VDS interpreter is loaded, without having to open a new window like with the following example:
Code: | dialog add,edit,edit1,10,10,180,25,First name
dialog add,edit,edit2,40,10,180,25,Last name
dialog add,button,button1,70,10,180,25,Submit
:Evloop
wait event
goto @event()
:Button1button
info Hello @dlgtext(edit1) @dlgtext(edit2)
goto Evloop |
Have fun!
Description: |
|
Download |
Filename: |
Interpreter.zip |
Filesize: |
10.81 KB |
Downloaded: |
2562 Time(s) |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|