Tutorial: Creating an AL Plugin

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Tutorial: Creating an AL Plugin

Post by LV »

The procedure is pretty simple but has many rewards for stable and user friendly script packages.

Download link from xdownloads:
[ external image ]


Outdated links[/url]

[ external image ] download unpacked verson

[ external image ]

Cycrow installer version




The download contains 4 files, The 3 ALP scripts needed for every plugin and a t file to show how to load t files and add the description of the plugin for the players AL Menu


To use these scripts as a template all you need to do is copy them from the scripts dir and paste into your scripts dir again

Next rename them to the new name, the templates are named

Code: Select all

al.plugin.blank.template
al.blank.template.main
al.blank.template.events
eg. rename

Code: Select all

al.plugin.fish.hunt
al.fish.hunt.main
al.fish.hunt.events
as you can see the rename must only be the blank template part, If you remove events/main or plugin from the scripts listed above your game will die (possibly, i never tempted fate).

next you can rename through notepad which must be done.

there will be 2 entries, one at the top 1 further down at the start of the huge block of text. If you get this worng the game when you load it will not see the script

You must rename within the notepad 2x al.plugin.blank.template to al.plugin.fish.hunt

e.g.

Code: Select all

<?xml version="1.0" standalone="yes" ?>
<?xml-stylesheet href="x2script.xsl" type="text/xsl" ?>
<script>
<name>al.plugin.blank.template</name>
<version>0</version>
<engineversion>42</engineversion>
<description>Tutorial - AL Plugin by LV : use as a template</description>
<arguments>
</arguments>
<sourcetext>
<line linenr="001" indent=""><text>load text: id=</text><var>9998</var></line>
<line linenr="002" indent=""><comment><text>* </text><var>load your t file number</var></comment></line>
<line linenr="003" indent=""></line>
<line linenr="004" indent=""><text>al engine: register script=</text><call>al.rrf.main</call></line>
<line linenr="005" indent=""><comment><text>* </text><var>this load the al main script</var></comment></line>
<line linenr="006" indent=""></line>
<line linenr="007" indent=""></line>
<line linenr="008" indent=""><text>return </text><var>null</var></line>
</sourcetext>
<codearray>

<sval type="array" size="10">
  <sval type="string" val="al.plugin.blank.template"/>
  <sval type="int" val="42"/>
  <sval type="string" val="Tutorial - AL Plugin by LV : use as a template"/>
  <sval type="int" val="0"/>
  <sval type="int" val="0"/>
  <sval type="int" val="0"/>
  <sval type="array" size="3">
    <sval type="array" size="3">
      <sval type="int" val="151"/>
      <sval type="int" val="4"/>
      <sval type="int" val="9998"/>
    </sval>
    <sval type="array" size="2">
      <sval type="int" val="1000"/>
      <sval type="string" val="al.rrf.main"/>
    </sval>
    <sval type="array" size="3">
      <sval 
as you can see above there are 2 entries for al.plugin.blank.template, these are the ones that need renaming, i have used a very small script for example, normally you'll have to scroll a fair way done to the text block to find the second entry.


You obviously need to create a new t file for each time you create a new al plugin initialisation which is the same renaming method.


_____________________________________


Why should I bother


------------

When using a ALP you can set the time every time you want to call a specific script. More importantly you can run an uninstall script if a user wants to remove one of your scripts without leaving READTEXT issues and such in the game which they will rightly complain about and make you script look a little dirty to other users if your script thread has these complaints.

Once you get your head around the C+P method above it takes about 3 mins to create the 3 ALP scripts needed opening the door to better script usage in many areas.

I have also added comments inside the scripts to show your more ways of refining your abilities in the dark arts ;)


________

LV


Edit: reuploaded to Xdownloads. X2-Illuminatus
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

si tacuisses, philosophus mansisses
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Just a small idea, rather then telling people to rename via notepad or what ever, why not just get them to copy the script inside the X3 SE (And give it its new name then)

Its mistake free that way, and will refresh instantly (instead of on next load)
User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV »

feel free to add the howto as i don't use it and i'll put it in the FP
Hieronymos
Posts: 830
Joined: Fri, 30. Dec 05, 22:14
x3

Post by Hieronymos »

Thanks for being the first to make an XTC MD alp tutorial LV.

Considering how well all the stock vanilla missions work, creating multi-mission quests should be relatively straightforward. Creating a quest reward system to reward the sum total of a multimission quest--that doesn't seem apparent..yet.

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”