Page 1 of 1

Adding commands

Posted: Sun Jun 01, 2008 10:49 pm
by jcoggins
If I were interested in adding some new commands to the PB language how would I go about doing it?

Jason

Posted: Sun Jun 01, 2008 11:28 pm
by Rook Zimbabwe
To clarify:

Do you mean adding new gadgets?

or

New command statements?

You could do either with a DLL I would think.

Posted: Mon Jun 02, 2008 10:23 am
by tinman
Look in the LibrarySDK folder of your PB install. There are documents and examples of how to create libraries with new commands and plugins for different image formats and gadgets / controls.

Posted: Mon Jun 02, 2008 1:09 pm
by Psychophanta
The easiest and simplest way i think is to write Macros with ASM inside and save it as PB include files.
Then, hop!, there are new custom commands for their use :!: :wink:

Posted: Mon Jun 02, 2008 2:52 pm
by pdwyer
Psychophanta wrote:The easiest and simplest way i think is to write Macros with ASM inside and save it as PB include files.
Then, hop!, there are new custom commands for their use :!: :wink:
Why with ASM inside? :?:

Re: Adding commands

Posted: Mon Jun 02, 2008 3:01 pm
by ricardo
jcoggins wrote:If I were interested in adding some new commands to the PB language how would I go about doing it?

Jason
Create a lib with regular PB code. (use ProcedureDLL for exported funcionts) and then use TailBite to make them a lib.


Look here for TailBite: http://www.purebasic.fr/english/viewforum.php?f=26

Something like this:

Code: Select all

ProcedureDLL MyNewCommand(param)
  ;do whatever you want
  ProcedureReturn 1
EndProcedure

Posted: Mon Jun 02, 2008 3:18 pm
by Psychophanta
pdwyer wrote:Why with ASM inside?
Because sure with ASM can be done the most powerful commands. :)

Posted: Mon Jun 02, 2008 3:43 pm
by pdwyer
oh ok, sorry, I was trying to match with "easiest and simplest" ;)

Posted: Thu Jun 05, 2008 1:59 am
by jcoggins
Actually, I was thinking more alone the lines of adding a new command that did something the current version of the language does not do. For example, a moviePlaying command that can be used with an .mp3 audio file that returns true if the movie is playing or false otherwise. Or a command that can be used to get the length (in seconds) of an .mp3 file (that does not contain frames).

Jason

Posted: Thu Jun 05, 2008 7:55 am
by pdwyer
In that case you are probably looking to create a lib. Take a look at the tailbite section of the forums. You can create a proc to do what you want and then use tailbite to create the lib and put it in a certain PB direction and PB will use it like it's own addins for database, linkedlists or whatever

atleast that's my understanding, I've never actually bothered to do it myself, I just create include files and add them when I need them

Posted: Thu Jun 05, 2008 2:24 pm
by Kaeru Gaman
For example, a moviePlaying command that can be used with an .mp3 audio file that returns true if the movie is playing or false otherwise. Or a command that can be used to get the length (in seconds) of an .mp3 file (that does not contain frames).
how to include the commands, you have some ways now - Includes, DLLs or UserLibs.

how to program it, you'll have to learn some API-stuff and some ASM.
you have to know how to program it, if you want to include a command that returns the length of an mp3.