[SCRIPT] Player Workshops V2.0 [28.07.2009]

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

Bobisback
Posts: 81
Joined: Fri, 20. Nov 09, 03:10

Post by Bobisback » Wed, 21. Dec 11, 21:39

is there anyway to easliy add support for other equipment that is added by other mods? like MARS, mefos, travel drive?

P.S nevermind I figured out how to add them :) I am happy

great mod makes life so much easier thanks :D

jiunejai
Posts: 56
Joined: Fri, 4. Mar 11, 08:47
x4

Post by jiunejai » Tue, 6. Mar 12, 11:21

Could anyone teach me how to add new equipment in the setting menu?
I edit plugin.pelador.workshop.ref, but seems not work :?

EDIT:
I have solved it!

The following are steps to add new equipment into menu:

1. Edit "plugin.pelador.workshop.ref". Add a line for new equipment into $equipment array, you can copy existing one then edit, or insert a new one by yourself.
  • code form is $equipment [ array number ] = equipment.name

    i.e.:

    Code: Select all

    $equipment [ 32 ] = MARS - Motion Analysis& Relay System
2. In same script file, edit $include array. To avoid error, give argument for controlling include or not.
  • code form is $include [ array number ] = 0/1,
    notice that 1=include, 0=disinclude.

    i.e.:

    Code: Select all

    $include [ 32 ] = 0
3. Edit $no.equipment with "lastest array number +1".
  • The argument $no.equipment should be found in first 10 lines of follow script files:
    • plugin.pelador.player.workshop
      plugin.pelador.workshop.cfg
      plugin.pelador.workshop.ref

Andyrids
Posts: 248
Joined: Sat, 16. Aug 08, 19:45
x3tc

Post by Andyrids » Mon, 19. Mar 12, 11:06

Hi great script !

I have been trying to add the functionality to M6 class (Hyperion) without much success I added :

Code: Select all

or $class == M6 2026
To .player.dock.chk.xml at Lines 26 & 39

I gather I also have to add info to the <sval also and update each array size by 6 in the same file ?

Code: Select all

      <sval type="int" val="131074" />
               <sval type="int" val="4" />
               <sval type="int" val="12" />
               <sval type="int" val="2026" />
               <sval type="int" val="15" />
               <sval type="int" val="0" />
Would that be correct or am I missing something ? since I cant seen to get it to work on my M6, the edits do not break the existing script either so I must be close ?

Thanks.

Andyrids
Posts: 248
Joined: Sat, 16. Aug 08, 19:45
x3tc

Post by Andyrids » Tue, 20. Mar 12, 10:30

Well so far I got it to work on existing M6 & M7's BUT if you spawn a new one or even a new TL or M1 then the "workshop" command is greyed out...

This is what I have so far :

Code: Select all

Line 26
      <line linenr="014" indent="  "><var>else if </var><text></text><var>$class == M1 2021 OR $class == TL 2032 or $class == M6 2026 or $class == M7 2027 </var><text></text></line>

Line 39
      <line linenr="027" indent="  "><var>if </var><text></text><var>$class == M1 2021 OR $class == TL 2032 or $class == M6 2026 or $class == M7 2027 </var><text></text></line>
And then further down in the same file :

Code: Select all

            <sval type="array" size="37">
               <sval type="int" val="104" />
               <sval type="int" val="-1610609147" />
               <sval type="int" val="7" />
               <sval type="int" val="131074" />
               <sval type="int" val="4" />
               <sval type="int" val="12" />
               <sval type="int" val="2021" />
               <sval type="int" val="15" />
               <sval type="int" val="0" />
               <sval type="int" val="131074" />
               <sval type="int" val="4" />
               <sval type="int" val="12" />
               <sval type="int" val="2032" />
               <sval type="int" val="15" />
               <sval type="int" val="0" />
               <sval type="int" val="131074" />
               <sval type="int" val="4" />
               <sval type="int" val="12" />
               <sval type="int" val="2026" />
               <sval type="int" val="15" />
               <sval type="int" val="0" />
               <sval type="int" val="131074" />
               <sval type="int" val="4" />
               <sval type="int" val="12" />
               <sval type="int" val="2027" />
               <sval type="int" val="15" />
               <sval type="int" val="0" />
               <sval type="int" val="15" />
               <sval type="int" val="10" />
               <sval type="int" val="7" />
               <sval type="int" val="-1" />
               <sval type="int" val="0" />
               <sval type="int" val="-2" />
               <sval type="int" val="10" />
               <sval type="int" val="-4" />
               <sval type="int" val="0" />
               <sval type="int" val="-5" />
            </sval>
There is 2 blocks with same code and I edited them both...

The fact that it works with existing ships means I'm on the right track here, there must be some other value I need to increment but not knowing what the other numbers in the sval list relate to is probably the reason why it wont work with a newly spawned ship...

Any help here greatly appreciated
:)

Andyrids
Posts: 248
Joined: Sat, 16. Aug 08, 19:45
x3tc

Post by Andyrids » Mon, 26. Mar 12, 07:47

Still struggling to get this to work properly, I have been studying <sval> types and values in other scripts that deal with player ships and see similarities but blindly changing the values as one would expect has random catastrophic results at times...

A few pointers / help would be much appreciated guys please :)

NovaStark
Posts: 12
Joined: Tue, 5. Jun 12, 03:47
x3tc

Post by NovaStark » Thu, 7. Jun 12, 20:24

ohhhhhh... I had forgotten about this little beauty of a script. Equipping new ships with tunings and software is the bane of my existence. So setting this up asap.

@Andyrids I'm not a scripting wiz when it comes to X3 but if you have it working on existing ships than maybe what is missing is a variable being set on new ships? As in there's a script that runs in the background searching for new player ships at a certain interval (or uses an event/callback) to set this variable based on the criteria you've been modifying?

Anyhow this is just a guess as it would seem simple to check for a variable as each ship docked rather than run it against an array of allowed ships at every single docking.

To put it simply check once and never again. Ships don't usually change classes once created :P

*edit*
@jiunejai - Thanks for posting your changes! Saved me some time and headache. Just made them myself and it seems to work beautifully. Just a note to anyone else you may have to save/quit/reload to get everything in sync. Before I did I was able to add Mars to a install set but adding the set didn't install Mars and Mars didn't show up in the regular equipment list.

*edit2*
Andyrids wrote:Still struggling to get this to work properly, I have been studying <sval> types and values in other scripts that deal with player ships and see similarities but blindly changing the values as one would expect has random catastrophic results at times...

A few pointers / help would be much appreciated guys please :)
I'm not sure what file you were looking in or what exactly you're trying to accomplish. I didn't see anything that would block the use of the workshop command on any class of ship. The only thing I can figure is that your trying to get the auto equip to work with a certain class?

/shrug. If this is still something you're trying to do I could look at it more, but I kinda doubt it considering the age of your post.

Is the Hyperion even in X3TC?

Andyrids
Posts: 248
Joined: Sat, 16. Aug 08, 19:45
x3tc

Post by Andyrids » Fri, 8. Jun 12, 09:25

Hi NovaStark.... Yes the Hyperion is in TC and the plan was to get this script to work with that ship and also the Griffin... But since I could only get it working with existing ships I decided to delete my version of the script, revert back to the original one and just change ship class to M2 for those two ships...

But you are correct it is just some variable / flag that I am missing upon a new ship of the above mentioned spawning.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Fri, 8. Jun 12, 12:33

Andyrids wrote:But you are correct it is just some variable / flag that I am missing upon a new ship of the above mentioned spawning.
After three months... are you *still* trying to edit scripts without using the Script Editor or Exscriptor?

That's like spitting into the wind. ;)

Andyrids
Posts: 248
Joined: Sat, 16. Aug 08, 19:45
x3tc

Post by Andyrids » Fri, 8. Jun 12, 14:52

DrBullwinkle wrote:
Andyrids wrote:But you are correct it is just some variable / flag that I am missing upon a new ship of the above mentioned spawning.
After three months... are you *still* trying to edit scripts without using the Script Editor or Exscriptor?

That's like spitting into the wind. ;)
With all due respect DrB I do not have the time to learn complex editors especially for what would appear to be quite a simple task... Obviously a task that my mind is to "simple" to complete successfully...

Just as a side note I spent many years building and helping others build UI's for a game called Everquest and do believe even after all this time mine are still in the top 10 most downloaded and used, probably updated now by some of the guys I taught in the past... I have no desire to take that path / steep learning curve again and rather hoped for the good nature of some members here to give me a pointer as to where my mistake lies.... or maybe that was my mistake ? :roll:

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24961
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Fri, 8. Jun 12, 15:14

I have no desire to take that path / steep learning curve again and rather hoped for the good nature of some members here to give me a pointer as to where my mistake lies.... or maybe that was my mistake ?
Well, your mistake is that you want to directly edit the script file and the helpful pointer by DrBullwinkle is to use one of the editors.

The Script Editor is even built into the game, so you don't have to download anything. It just needs to be activated.
The Script Editor is designed that way that commands have clear names, often saying what they do, and clear input fields, which can be selected with the mouse and/or arrow keys and Enter.

I would never suggest editing the script files directly in a text/xml-editor to anyone, be it a beginner in MSCI scripting or an experienced scripter.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Andyrids
Posts: 248
Joined: Sat, 16. Aug 08, 19:45
x3tc

Post by Andyrids » Sat, 9. Jun 12, 12:34

X2-Illuminatus wrote:
I have no desire to take that path / steep learning curve again and rather hoped for the good nature of some members here to give me a pointer as to where my mistake lies.... or maybe that was my mistake ?
Well, your mistake is that you want to directly edit the script file and the helpful pointer by DrBullwinkle is to use one of the editors.

The Script Editor is even built into the game, so you don't have to download anything. It just needs to be activated.
The Script Editor is designed that way that commands have clear names, often saying what they do, and clear input fields, which can be selected with the mouse and/or arrow keys and Enter.

I would never suggest editing the script files directly in a text/xml-editor to anyone, be it a beginner in MSCI scripting or an experienced scripter.
Again with all due respect... Im old school and do not need a script editor notepad2 works just fine.... so to an extent this is just a simple scripting problem.. and as I have stated I do not wish to get into hours of learning just for the sake of a simple mod to an existing mod ? (yes yes yes I know about file types and conversions and how they get messed up and whatever and know the work arounds)

Its quite simple really all I am asking for is with help with the script itself and flags whatever blah blah... I guess I have done most of it.. but since its such a big problem I also guess you rocket scientists do not know how to do it either.. that makes me feel good Im not such a dumass after all...

Its ok guys just go back to whatever it is that you do best and I wish you all well forget my silly problem :)

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24961
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Sat, 9. Jun 12, 15:04

It somehow amuses me that someone, who built UIs himself, refuses to use one with the explanation that using it would require "hours of learning". But hey, it's your decision. If you want to take the hardest way, feel free to do so. But then, please don't complain that it's difficult or that no one wants to help you.

Anyway, being a rocket scientist myself - thanks for noticing it - I was able to complete this task (allowing M6 ships to be used with this script) by simply doing, what you did, just in the Script Editor.

In case you're still interested in it: Download of plugin.pelador.player.dock.chk.xml over file-upload.net. Download and copy it to the "scripts"-folder of your game directory, so it replaces the existing file. Start the game/load a save and "Allow workshops to be used on ships" in the config menu.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Andyrids
Posts: 248
Joined: Sat, 16. Aug 08, 19:45
x3tc

Post by Andyrids » Sat, 9. Jun 12, 15:51

X2-Illuminatus wrote:It somehow amuses me that someone, who built UIs himself, refuses to use one with the explanation that using it would require "hours of learning".

Anyway, being a rocket scientist myself - thanks for noticing it -
My old on-line name is Laffs ... anyway yes they are very complicated as you stated you find it funny that's kool ....

Besides you made me the script anyway ! a bit of reverse psychology does work at times :) ... Thank you so much for doing so, Much appreciated :)

NovaStark
Posts: 12
Joined: Tue, 5. Jun 12, 03:47
x3tc

Post by NovaStark » Tue, 12. Jun 12, 22:53

Well, I can kinda understand where he's coming from a bit. When it comes to editing traditional code/html/etc I too prefer to use a text editor (like notepad++). But seeing as X3 has it's own scripting language and encodes the resulting files as XML it's much easier imo to just use the builtin editor.

Maybe if I was *very* familiar with all the commands and syntax I would use a text editor too, but as I'm a noob I wouldn't dare. Besides, even when coding in a traditional language it's sometimes nice to jump into an IDE to handle large projects or debugging. I guess it boils down to choosing the right tool for the job really.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 12. Jun 12, 23:04

NovaStark wrote:Maybe if I was *very* familiar with all the commands and syntax I would use a text editor too
No, no, no.

It has nothing to do with your experience with other editors. X3 uses xml like a database; it stores ID's rather than text strings. The readable text in scripts is just comments -- it is not the actual code. The real code is numeric ID's, which are, more or less, not human readable.

It is not a matter of which editor you prefer, as in other languages. You really must use an editor made for the job (if you want your scripts to work).

Otherwise, you are just spitting into the wind. ;)

NovaStark
Posts: 12
Joined: Tue, 5. Jun 12, 03:47
x3tc

Post by NovaStark » Wed, 13. Jun 12, 06:28

Ah, my bad. I honestly had never looked at the xml itself very hard. I suppose it is a lot easier to read in the id's than parse a bunch of text. ;) I've done enough of that to last a life time when trying to convert third party data into your own system. Even if there is documentation to the format there's invariably differences in the actual implementation that you just have to account for through trial and error. Industry specific file formats... bleh.. talk about haphazard hacks with no consistency.

Andyrids
Posts: 248
Joined: Sat, 16. Aug 08, 19:45
x3tc

Post by Andyrids » Wed, 13. Jun 12, 16:57

DrBullwinkle wrote:
NovaStark wrote:Maybe if I was *very* familiar with all the commands and syntax I would use a text editor too
No, no, no.

It has nothing to do with your experience with other editors. X3 uses xml like a database; it stores ID's rather than text strings. The readable text in scripts is just comments -- it is not the actual code. The real code is numeric ID's, which are, more or less, not human readable.

It is not a matter of which editor you prefer, as in other languages. You really must use an editor made for the job (if you want your scripts to work).

Otherwise, you are just spitting into the wind. ;)
Now that was useful info and interesting to know :) ... XML is a very flexible programming lang and can be built to your own needs its much like the old "Forth" in a way where you used to build routines and then break them down into a single command... anyway thank you guys for the help and advice no disrespect meant :)

User avatar
Nibel
Posts: 208
Joined: Sat, 29. Apr 06, 16:53

Post by Nibel » Fri, 14. Sep 12, 02:36

any problems with AP ?

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Fri, 14. Sep 12, 03:46

Nibel wrote:any problems with AP ?
OK, that's at least three. ;)

You can stop asking the question, Nibel. The answer is always going to be: "scripts for TC work fine for AP, unless otherwise noted."

Mods are more variable but most of those, too, are clearly marked if they do not work in AP.

User avatar
Nibel
Posts: 208
Joined: Sat, 29. Apr 06, 16:53

Post by Nibel » Fri, 14. Sep 12, 19:02

DrBullwinkle wrote:
Nibel wrote:any problems with AP ?
OK, that's at least three. ;)

You can stop asking the question, Nibel. The answer is always going to be: "scripts for TC work fine for AP, unless otherwise noted."

Mods are more variable but most of those, too, are clearly marked if they do not work in AP.
some mods so old,that they are were created b4 univerese was in god's plan,so there is a chance,that author/mods didn't stated,that this mod not working or working properly,plus i've noticed,that some users report problems(example:not all hotkeys are working) with mods,so asking same question for each mod is normal.
i better be sure than sorry.

Post Reply

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