Adding commands

Just starting out? Need help? Post your questions and find answers here.
jcoggins
User
User
Posts: 25
Joined: Sat Apr 12, 2008 12:30 am

Adding commands

Post by jcoggins »

If I were interested in adding some new commands to the PB language how would I go about doing it?

Jason
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post 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.
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post 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.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post 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:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post 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? :?:
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Re: Adding commands

Post 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
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

pdwyer wrote:Why with ASM inside?
Because sure with ASM can be done the most powerful commands. :)
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

oh ok, sorry, I was trying to match with "easiest and simplest" ;)
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
jcoggins
User
User
Posts: 25
Joined: Sat Apr 12, 2008 12:30 am

Post 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
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post 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
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
Post Reply