Plug-in & Script 101?

Is there some kind of user manual or introduction or anything for language used in creating plug-ins and scripts?

So far, I´ve found the AlienAPI documentation in the online exchange... which is useless to me. All the topics look like this:
UnitStarMeasureName

UnitStarMeasureName: String

User Contributed Notes and Examples
UnitStarMeasureName

... which, if you don´t already know what everything does and how to use it, isn´t exactly very helpful. I´ve taken a look at the sample scripts, but they´re still quite complicated and short on documentation on what everything does.

Comments

  • There's no intro doc other than whats in the API. The best bet is the sample scripts. It is complicated... but Astro is a complicated program.
  • Okay... not what I´d hoped to hear, but I´ll manage - somehow. ;)

    Is there any generator script I could look at, to see how it is done? The scripts available in the online exchange all seem to use the standard generator.
  • Okay... here´s what I´m trying to do:

    I want a script that goes through all the systems on the map and adds some custom data fields to all terrestrials; some of the content is derived from properties of the terrestrials themselves, the rest is randomly determined. Since the TravellerUWP script does something very similar, I´m using that as the basis for my script.

    To get the script to act on every terrestrial rather than on all inhabited worlds, I´d have to replace
    If chiChild.Population >= Backwater then

    with
    if chiChild.BodyType = terrestrial then

    right?

    Let´s say I had the script put together a string called "Result", then to add Result as the value of a custom field named "Sample", what would I have to do? I found a method named SetField in the documention. Do I simply replace
    chiChild.gmnotes = Result

    with
    SetField (Sample; Result)

    or do I have to refer to this "chiChild" somehow?
  • Close... To check if a body is terrestrial, use (assuming 'b' is a Body object):
    if b.TypeID = BODY_TYPE_TERRESTRIAL then
    

    (look at the body type constants in the doc under the Body class.)

    To set a field, you can do:
    b.SetField  'fieldname', 'fieldvalue'
    

    ie, SetField is a method of the body class.

Leave a Comment