Author Topic: How to properly combine scripts  (Read 5021 times)

0 Members and 1 Guest are viewing this topic.

Offline chrisgbk

  • Moderator
  • Veteran
  • *****
  • Posts: 1739
How to properly combine scripts
« on: November 09, 2006, 07:32:50 pm »
This is going to start with a bit of a contrived example, and end with a real world one.

First off, all the events that the server generates can only be defined once. That means that when combining scripts, you may need to delete the blank template events from some of the other files. I recommend that if you wish to combine scripts, that you use a single file instead of the 3 different ones ie: before you start, you combine all 3 template files into one, and edit that single file as apropriate.

Script 1:
Code: [Select]
const
// script 1 constants

var
// script 1 variables

procedure event1(//arguments);
begin
// script 1 event1 code
end;

procedure event2(//arguments);
begin
// script 1 event2 code
end;

Script 2:
Code: [Select]
const
// script 2 constants

var
// script 2 variables

procedure event2(//arguments);
begin
// script 2 event2 code
end;

procedure event3(//arguments);
begin
// script 2 event3 code
end;

Combined:
Code: [Select]
const
// script 1 constants
// script 2 constants

var
// script 1 variables
// script 2 variables

procedure event1(//arguments);
begin
// script 1 event1 code
end;

procedure event2(//arguments);
begin
// script 1 event2 code
// script 2 event2 code
end;

procedure event3(//arguments);
begin
// script 2 event3 code
end;

Now for the real world example:

Script 1: upTime
Script 2: mapsList
Combined Result

Good luck, and if you need help post in this forum and ask.

Edit:

Note, that if you use a script that defines helper functions, and another script uses a function by the same name, you will have to make some changes yourself. If they are exactly the same (or, for advanced users, perform the same function but differently), only use one copy of the function. Otherwise, if 2 functions are named the same but perform different tasks (which should never happen, but is not to be discounted entirely), you will need to rename one of them, and edit the affected parts of the script to reference to the renamed function yourself. This is best done BEFORE combining, so compare scripts and make notes of any issues before you start.
« Last Edit: April 19, 2007, 01:03:44 am by chrisgbk »

Offline mikembm

  • Soldier
  • **
  • Posts: 210
Re: How to properly combine scripts
« Reply #1 on: June 10, 2007, 04:35:27 pm »
If you are still having problems after reading this you may want to try out my Script Combiner:
http://forums.soldat.pl/index.php?topic=15629.0