Page 1 of 2

Any usable scripting language for PB?

Posted: Tue Mar 06, 2012 5:02 pm
by erion
Hi,

I'm currently working on a project which badly needs a scripting language for design and to call functions from the host application (i.e. from the pb compiled program).
I've tried Lua, as it is quite popular and easy to learn, however I'm unable to retrieve any error string upon a syntax/runtime error, as the stack returns only an error code, I assume.
My question is, does anyone know any, possibly painless scripting language which could interface with pb with the following features?
1. Possibly no C-like syntax.
2. Is able to call functions from the host application.
3. Has typeless variables, or as few types as possible
4. Not a requirement, but oop for faster development.
If the language is good enough, I'm willing to sacrifice the no C syntax :)

Any help is appreciated.
Erion

Re: Any usable scripting language for PB?

Posted: Tue Mar 06, 2012 5:07 pm
by Thorium
There are actualy PB script engines. I remember Operno and PaladiumX.
A search for those words might help you.

Re: Any usable scripting language for PB?

Posted: Tue Mar 06, 2012 5:46 pm
by Zach
I think I looked at those before, and while they were off to a good start I'm not sure if they are actively maintained which could be a problem when trying to use for more than experimentation.

It really would be nice if we had an easy way to integrate LUA, Python, or Ruby :? Something with no hassles and easy setup..

I know several people have worked on Python includes (wrappers?) so you may want to try searching for that as well.

Re: Any usable scripting language for PB?

Posted: Tue Mar 06, 2012 5:58 pm
by erion
Thanks, I'll have a go at the pb engines and wrappers.
Python, Lua and Ruby would be the best indeed, though they have a really painful API. Especially python, where you have dozens of nested structures and macros, procedures with structure parameters, etc.

Erion

Re: Any usable scripting language for PB?

Posted: Tue Mar 06, 2012 7:36 pm
by Zach
Personally, I loved the time that I spent learning Python.. I didn't learn a whole lot, in terms of using more advanced stuff or anything like that, but for an Object Oriented language it was the most fun I've had, and most progress I ever made learning a language.

Ruby on the other hand, in a lot of ways seems so easy that I'm too stupid to learn it.. I don't know why, but it always frustrates me the way it does a lot of things, and the way some of the syntax is setup.

LUA I've never really played with because it looked a lot more terse as a language, and cryptic to understand. But I know it is used in lots of games and such.

But realistically I'd take any of the 3 above, with Python being my favorite for now.

Re: Any usable scripting language for PB?

Posted: Fri Mar 09, 2012 3:12 pm
by Erich
Probably not what you're looking for but you could also take a look at some of the numerous Scheme implementations out there.

Small ones: e.g. SIOD, TinyScheme, Scheme 9 from Empty Space (http://www.t3x.org/index.html) -- the last one is kinda cool, it's super-small and still comes with big number support :D, but you can probably only make sense of it if you buy the accompanying 30$ book.

Bigger extension languages: Elk, Guile

Huge with JiT compiler: Racket

Extensible Scheme to C compilers: Chicken scheme, Stalin (produces C code that is often faster than handcrafted C)

I understand many people don't like LISP syntax but they have one advantage, they allow you to define your own domain-specific language very easily, i.e. you can abstract the interface to your app to a very high-level. Some of them like Racket are also pretty fast, faster than Python and Lua, but I guess only the smaller ones are easy to embed. AFAIK, none of them have been interfaced with PB yet.

Re: Any usable scripting language for PB?

Posted: Sat Mar 10, 2012 2:23 am
by xorc1zt
actually python is the best overall language you could find. python has everything and a very huge community which do a lot of open works but the main problem is that you will probably need a DLL written with C to interface python with purebasic. Otherwise, Guile is quite good and can compile Emacs Lisp and ECMAScript (Lua support coming soon) but still not widely know. If you want the most simple but still power full, choose Lua. Lua would be my choice for purebasic, the interface is very easy to implement and there are a lot of examples and tools.

Re: Any usable scripting language for PB?

Posted: Sat Mar 10, 2012 3:44 am
by Derren
Choosing a scripting language is not enough.
You need a way to interact with the script.
Simply running a script is not enough in most cases (especially in game programming).

Here's a LUA implementation. Unfortunately it hasn't been updated. It's for PB 4.0 and the LUA version is also older.
http://www.realsource.de/index.php/down ... pb-include

I have researched a way to use python with PB. No luck. There's no simple library to interpret python.

And then there's this: http://translate.google.com/translate?h ... 6t%3D21646

Re: Any usable scripting language for PB?

Posted: Sat Mar 10, 2012 12:19 pm
by blueb
You may want to search for "Autowin"... a PureBasic scripting language. The source is also included in the ZIP from ts-soft on this site.

Re: Any usable scripting language for PB?

Posted: Sat Mar 10, 2012 3:22 pm
by Derren
Not sure if this is suitable.
It's like AutoIt. There's no math, no strings, I don't even know if you can share variables.

Here's the command list:

http://www.realsource.de/index.php/down ... 24-autowin

AW_ChangeMatchMode
AW_FindHiddenWindow
AW_ControlClick
AW_ControlDisable
AW_ControlEnable
AW_ControlFocus
AW_ControlGetHandle
AW_ControlGetText
AW_ControlHide
AW_ControlMove
AW_ControlSetText
AW_ControlShow
AW_MouseClick
AW_MouseDown
AW_MouseMove
AW_MouseUp
AW_SendKeys
AW_WinActivate
AW_WinActive
AW_WinClose
AW_WinExists
AW_WinGetProcess
AW_WinGetState
AW_WinGetStateEx
AW_WinGetTitle
AW_WinHandle
AW_WinHideFromTaskBar
AW_WinKill
AW_WinMinimizeAll
AW_WinMinimizeAllUndo
AW_WinMove
AW_WinSetOnTop
AW_WinSetState
AW_WinSetStateEx
AW_WinSetTitle
AW_WinWait
AW_WinWaitActive
AW_WinWaitClose
AW_WinWaitNotActive

Re: Any usable scripting language for PB?

Posted: Sat Mar 10, 2012 4:51 pm
by ts-soft
The functions in autowin a like autoit, but it is no scripting language, it is a lib for pb users :wink:

Re: Any usable scripting language for PB?

Posted: Sat Mar 10, 2012 8:26 pm
by ultralazor
There is actually a fast way to make your own, that is stable and fast. Make a stack-machine with symbol tables and internal pointers. There is also a way to use bison and flex to generate them in C++.

There are no easy ones. Gamemonkey and Lua are the easiest, and Lua is better cause you can disable modules for different security domains and it has an army of veteran engineers as developers..

Re: Any usable scripting language for PB?

Posted: Sun Mar 11, 2012 12:37 am
by void
ultralazor wrote:There is actually a fast way to make your own, that is stable and fast. Make a stack-machine with symbol tables and internal pointers.
This is what I'm doing. I've already got a language+VM capable of integer and floating point math, string manipulation, and recursion.

forth-like languages are very good at rapid DSL work, too, if you aren't challenged by stack-based programming.

Re: Any usable scripting language for PB?

Posted: Thu Apr 26, 2012 11:47 pm
by Zach
I've never attempt anything like stack-based programming.. I'd probably suck at it, but at the same time I'd be interested in any newbie type links on the subject.

Re: Any usable scripting language for PB?

Posted: Sat Apr 28, 2012 12:59 am
by void
Zach wrote:I've never attempt anything like stack-based programming.. I'd probably suck at it, but at the same time I'd be interested in any newbie type links on the subject.
This is in assembly, but the principles are pretty easy to follow.
http://git.annexia.org/?p=jonesforth.git;a=tree

The files to read are jonesforth.S and jonesforth.F

They're more documentation than actual code.