How to make BBS missions using the script engine

The place to discuss scripting and game modifications for X³: Reunion.

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

Mysterial
Posts: 589
Joined: Wed, 6. Nov 02, 21:31
x4

How to make BBS missions using the script engine

Post by Mysterial » Sat, 19. Nov 05, 06:54

After much trial and error, I've figured out much about creating BBS missions using the script engine.

It works a lot like the AL engine; you register a script as a BBS mission script and the BBS system calls your script with certain event strings that you must use to perform some action.

The register function is under General Commands: "register quest script <script name> instance multiple=<number>". Instance multiple is the maximum number of instances of this mission that may be offered/running simultaneously.

BBS mission scripts have four parameters:

1: The quest object. (this is NULL for 'init' and 'reinit' events) This is for use to pass to the various quest updating functions that take a variable of type 'Var/Quest'. Note that said type isn't selectable as a script parameter type, you must use 'Value'.
2: The event string. The event strings that I've found are described below.
3. Instance data array. This array can be filled with whatever you want and every time your quest script is called with an event, the data array that corresponds to that instance of the quest is sent. This is where you store what the player needs to do and what's happened so far, for example how many wares the player needs to buy and how many he's got so far.
4. Question choice. This contains whatever the player chose when the quest gives him a question (with [select value=whatever] in the text) using the 'set quest state with message' function.

The events that I've seen so far are:

init: sent when you register the script
reinit: sent when you load a savegame where the script is registered
prio: sent to get the priority of your mission (the likelihood of it being offered). I'm not sure what the correct range of values is here, but returning higher numbers seems to be more likely to appear.
offer: sent when the BBS system wants to offer your mission. You must set the quest state to Quest.Offered (it's in the list of constants) with the message you want to display by using the 'set quest state with message' function in General Commands. The message must have at least one [select value=whatever] or the player won't be able to actually activate it.
display: sent when the player actually looks at the mission in the BBS.
select: sent when the player picks one of the choices your offer text had. Parameter 4 holds what they chose. If the player is allowed to take the mission, you should set the quest state to Quest.Accepted, otherwise set it to Quest.Aborted.
accept: sent when the quest state is set to Accepted.
check: sent periodically once the quest has been accepted. I know for sure it's sent every time you enter a station or gate. This is where you check on the progress of the mission. You should set the quest state to Quest.Finished when the mission is over.
destruct: sent when the mission has been removed from the system (because the player didn't select it in the BBS and the timeout expired, because it was aborted, or because it was finished, it doesn't matter). This is where you do any cleanup operations.

As with AL engine plugins, you can't register quests in a startup script prefixed with 'init'. You can use a 'al.plugin' script, however. There might be a special prefix for BBS mission startup scripts, but I haven't found it yet.

You can tag an object to call your quest when certain events happen to it. To do this, use the function 'add event listener'. This function takes three parameters; 1) the quest object as passed to the first parameter to your quest script, 2) the event type you're interested in (one of the constants that starts with 'Quest.Event'), and 3) the script to call when the event occurs. The script will be given the same parameters as your quest script, except that parameter 2 will be the name of the event that you were looking for ('killed', 'captured', etc) and parameter 4 will be the object that the event happened to. The script can be your quest script; you don't have to write a seperate one. Unfortunately, objects only seem to support one event per quest at a time, so you cannot for example hook up both 'Quest.Event.Killed' and 'Quest.Event.Captured'.

Hope this is helpful! Please add anything you discover :)
Last edited by Mysterial on Sun, 20. Nov 05, 02:23, edited 1 time in total.

bendyspex
Posts: 708
Joined: Tue, 13. Apr 04, 10:39
x3

Post by bendyspex » Sat, 19. Nov 05, 11:30

Does this mean we will be seeing new BBS missions being made soon? If so thats great, hopefully the missions will be a lot more imaginaive than the ones currently available.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21061
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Sat, 19. Nov 05, 14:21

nice one finding out :)

will have to have a play aorund with it

Mysterial
Posts: 589
Joined: Wed, 6. Nov 02, 21:31
x4

Post by Mysterial » Sun, 20. Nov 05, 02:42

Found out some more stuff about registering missions and mission events that I've added above.

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

Post by LV » Sun, 20. Nov 05, 11:24

How about uploading an example script, I've spent enough days/weeks/eons frustrating myself trying to get the BBS integrated :evil:
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

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21061
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Sun, 20. Nov 05, 14:30

i've managed to get BBS missions working now, i will soon release the script as an example of how its done, seems pretty simple so far

the "prio" event is sent when you first check the bbs in a station, and is only sent once until you leave the sector.

So if you dock at a station and view the BBS, the prio will be sent to the script, but wont be sent again until you leave the sector and dock again.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21061
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Sun, 20. Nov 05, 15:22

Heres an example script, its quite basic
it adds a bbs entry to overtune your ship, when accepting, it will add extra engine tunings to your ship

Download Rar Archive

User avatar
Red Spot
Posts: 3224
Joined: Fri, 4. Feb 05, 14:44
x3

Post by Red Spot » Sun, 20. Nov 05, 15:33

:thumb_up:

and
LV wrote:How about uploading an example script, I've spent enough days/weeks/eons frustrating myself trying to get the BBS integrated :evil:
Lord Vader .. the Force .. its .. I cant feel it anymore ..;):P


G

Mysterial
Posts: 589
Joined: Wed, 6. Nov 02, 21:31
x4

Post by Mysterial » Sun, 20. Nov 05, 16:23

Here's an example of the mission I'm working on that shows most of the things I've found so far. It's kind of messy and still has debug code and such but it shouldn't be too hard to understand.

Example mission

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

Post by LV » Sun, 20. Nov 05, 17:16

Red Spot wrote::thumb_up:

and

Enough to have his spleen removed with a blunt instrument
You have no idea how much I hatethe BBS already, I tried working it out more times that you've been reject by women and the last time I checked Norris McWhirter wanted to put that record in his book.

LV runs off with the above two scripts like a child with a pocket full of stolen candy.

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21061
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Sun, 20. Nov 05, 17:21

hehe, good luck adding them into ur scripts
:)

999-JAY-999
Posts: 610
Joined: Mon, 7. Apr 03, 16:29
x3tc

Post by 999-JAY-999 » Mon, 21. Nov 05, 15:22

A RAY of hope...... fledging out the bare mundane BBS system.... RIGHT ON!

:)
System Spec :-

AMD Athlon(tm) 64 Duel 6000+ (3.01GHz)
Windows XP Home Ed. SP 3
ATI Radeon HD 4850 (512)
Creative X-FI Soundard
2.00 GB of RAM
G9 RAZOR Mouse

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

Post by LV » Tue, 22. Nov 05, 21:44

Imperial respect here guys, If it wasn't for the fact my GF Card is melting currently I'd have some BBS up and running :thumb_up:
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

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 21061
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Thu, 1. Dec 05, 01:22

Just a few things i've found out

the command

Code: Select all

set quest <Var/Quest> timeout to <Var/Number>
is used to set the timeout event, after the given time it will call the "timeout" event followed by the "destruct" and the quest is ended

the command

Code: Select all

set quest/event <Var/Quest> timer to <Var/Number>
is used to set the timer event, after the given time the "timer" event will be called, this only seems to be called once.

Both commands only work after the quest as been accepted

User avatar
DeltaWolf
Posts: 594
Joined: Tue, 6. Jul 04, 08:48
x3

Post by DeltaWolf » Mon, 5. Dec 05, 10:04

Anybody figured out how to add a BBS news article? - does it work the same as the quest ones, or is it completely different?

Post Reply

Return to “X³: Reunion - Scripts and Modding”