December 07, 2019, 12:49:50 PM

Author Topic: How can I make specific functions accessible and others not  (Read 203 times)

Online Hardcoal

  • Sr. Member
  • ****
  • Posts: 317
How can I make specific functions accessible and others not
« on: November 11, 2019, 03:35:19 PM »
Hi. Im getting to the serious parts of this editor im working on.
I have lack of knowledge in many advanced terms.. like modules.. etc..
I have no idea what a Module is. I just use them.

But I have some Idea of what they are.

Anyway.. the point of this post is..
Since Ive added programming to my editor, I want people to get access to my Engine Commands..
So when they open a File for Edit, it will auto complete my commands when typing.

When I open my who project its no problem in blide. it auto complete my commands
but when someone will open only one file he will have no clue what my commands are.

So.. any idea how thats suppose to be done.
Are modules is what im suppose to do?
I have no clue.
Thanks

Offline degac

  • Full Member
  • ***
  • Posts: 123
    • graphio.net
Re: How can I make specific functions accessible and others not
« Reply #1 on: November 11, 2019, 07:33:59 PM »
Hi
basically a module is just a 'piece of code' that will be compiled and stored. Everytime a program needs it, BlitzMax simply skip the part of compiling it and link to the other source.

If you open a module like Audio (C:\BlitzMax150\mod\brl.mod\audio.mod\audio.bmx) you will see something like this, where in the REM...END REM block there are some tags to define the command (in this case LoadSound, from the function below).

Code: [Select]
Rem
bbdoc: Load a sound
returns: A sound object
about:
@url can be either a string, a stream or a #TAudioSample object.
The returned sound can be played using #PlaySound or #CueSound.

The @flags parameter can be any combination of:

[ @{Flag value} | @Effect
* SOUND_LOOP | The sound should loop when played back.
* SOUND_HARDWARE | The sound should be placed in onboard soundcard memory if possible.
]

To combine flags, use the binary 'or' operator: '|'.
End Rem
Function LoadSound:TSound( url:Object,flags=0 )
Return Driver().LoadSound( url,flags )
End Function

So basically you can define what commands the final user should see using REM..END REM blocks just before the function definition.

ie:

Code: [Select]
Rem
bbdoc: Init engine
returns: nothing
about:
It will initialize the engine, setting up basic world bla bla
End Rem
Function InitEngine:Int()
...
End Function
If there's a problem, there's at least one solution.
www.blitzmax.org

Online Hardcoal

  • Sr. Member
  • ****
  • Posts: 317
Re: How can I make specific functions accessible and others not
« Reply #2 on: November 11, 2019, 07:38:51 PM »
Ok that's awesome im gonna experiment on that.
Great effort by your side degac thanks

Offline Brucey

  • Jr. Member
  • **
  • Posts: 92
Re: How can I make specific functions accessible and others not
« Reply #3 on: November 13, 2019, 05:20:42 PM »
Are they programming "in" your editor, or are they going to be using something like MaxIDE?

Will they be using a scripting language or BlitzMax to interact with your engine APIs?


Online Hardcoal

  • Sr. Member
  • ****
  • Posts: 317
Re: How can I make specific functions accessible and others not
« Reply #4 on: November 13, 2019, 05:41:05 PM »
It will use anything that Edits Blitzmax Code Like MaxIDE..
I  didnt make my own language or something :)
Btw Xors3D has some internal scripting.. that can be run while the engine is running.
Pretty cool thing..

Im trying to create a comfortable environment for fast game making.
I haven't totally achieved it atm.
Im on a trial and error situation.

I could have managed pretty well using only blueprint if i kept developing it. but the problem is, I  cant make zoom in and out on my blueprint
which makes it very hard to work with.

Coding in my Editor means.. Creating a new blueprint behavior..
so... when you program something that means you can implement it on any object..
so it makes it very worthy.. for you and for others

im slowly fixing and adding matters to my editor to make it workable and worth looking..