more question

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

more question

Post by enric »

Sorry Pip I've more question :oops:

I'm trying to make a library with several functions.

1) is there a way to compile a ready library so you can include compiled?.

2) to make some function independent, is there a way to pass a pointer as a parameter?
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Re: more question

Post by pipfromslitherine »

I'm not sure what you mean. The scripting system doesn't include libraries - if you mean a collection of function that you want to use over and over then just create a BSF with them in, and you can then include it at the top of anywhere you want to use it

include "somefile.bsf"

the scripting system doesn't have any concept of pointers. What are you trying to achieve?

Cheers

Pip
enric
Brigadier-General - 8.8 cm Pak 43/41
Brigadier-General - 8.8 cm Pak 43/41
Posts: 1855
Joined: Sun May 15, 2011 8:47 am

Re: more question

Post by enric »

  • 1) A library of functions like the already used but already compiled, to avoid BA compile every time it uses, or maybe it is always interpreted?
    exemples:
    include "functions.BSF"
    include "tools.BSF"
    include "myFuntions.BSF"
  • 2) A pointer to a variable as way to change its value without knowing about it.
    Now, you're obliged to process the returned value, and only one value can be returned.
    Imagine I've a global gMyGlobal (or a local).
    I would call a functions passing the actual value of gMyGlobal and the function will attempt to change it.


    The call:
    int i;
    i = MyFunction (gMyGlobal, others,…);
    SetGlobal ("gMyGlobal", i);


    FUNCTION MyFuntion (theValue, others, etc.)
    {
    // do some job
    theValue += 1; // or anything else
    return theValue;
    }
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Re: more question

Post by pipfromslitherine »

1 - BA parses scripts each time it runs. There is pretty much no real cost to it, it is very quick. Just put functions in a bsf and include them.

2 - there isn't any way to do this currently. It is definitely a restriction in the language (hence the GetUnitX and GetUnitY functions). I have language improvements on my todo list, but there is a ton of other stuff too :(.

Cheers

Pip
Post Reply

Return to “Battle Academy : Modders Corner ”