.xsd's ... just what? And how? :3

The place to discuss scripting and game modifications for X Rebirth.

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

iforgotmysocks
Posts: 1244
Joined: Fri, 8. Nov 13, 22:35
x4

.xsd's ... just what? And how? :3

Post by iforgotmysocks »

So i ... well... tried to play around with xsd's trying to add a functionallity what pretty fast ended up in absolute despair. :3

Code: Select all

      <xs:element name="set_object_hull">
        <xs:annotation>
          <xs:documentation>
            Set an objects hull value (percentage)
          </xs:documentation>
        </xs:annotation>
        <xs:complexType>
          <xs:attribute name="object" type="object" use="required" />
          <xs:attributeGroup ref="random" />
          <xs:attributeGroup ref="action" />
        </xs:complexType>
      </xs:element>
I pretty much don't understand anything. xD
Those functions/definitions aren't defined anywhere else in any other files.
I just don't get it how this is supposed to work...
Equal values except the name and docu for different functions?
Just how? xD

Is this stuff just all about making it somewhat debugable, showing errors in editors and enabling IntelliSense like behaviour?
Is it even possible to create additional functions?

Help a newbie out here, will ya?
I almost never dealt with .xsd's before.

Thanks in advance,
ifor
User avatar
YorrickVander
Posts: 2774
Joined: Tue, 29. Oct 13, 21:59
x4

Post by YorrickVander »

xsd's don't define anything, theyre style sheets for the editor's syntax check.
X Rebirth - A Sirius Cybernetics Corporation Product

Split irritate visiting pilot with strange vocal patterns.
User avatar
arc_
Posts: 62
Joined: Sat, 7. Dec 13, 20:30

Post by arc_ »

Yes, the .xsd files are like help files: they just describe what's available, the game doesn't actually use them. To add new scripting functions, you'd have to patch XRebirth.exe.
User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13489
Joined: Sun, 15. Feb 04, 20:12
x4

Post by euclid »

Hmm .... I'm not entirely sure what you are trying to do. The xsd is a compendium of commands and the particular one has applications, for example:

Code: Select all

<do_if value="($Ship..hullpercentage ge 75) and ($Ship.hullpercentage lt 100) ">
<set_object_hull object="$Ship" exact="100" />
</do_if>
There is also a max or min hull command; latter is used in the plot MDs to make ship indestructible.

Not sure how much that helps.


Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
iforgotmysocks
Posts: 1244
Joined: Fri, 8. Nov 13, 22:35
x4

Post by iforgotmysocks »

Hm... thanks guys. :/
Thats exactly what i feared. ^^

Well, values received from macros seem to be read only properties and the only way to set them is using functions.
So... doing stuff like temporary altering values like weaponstrength, speed or whatever is not possible.
Which would be kinda ... lame.
Was trying to slow down a target after getting hit by a missile.
UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader »

then you should look into these ideas:

effects may be a beginning, not really sure if they have such a function though
change Engines (define a new, slower type of them and swap temporaily when hit)


and i am sure there is another approach to this, too.
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)
iforgotmysocks
Posts: 1244
Joined: Fri, 8. Nov 13, 22:35
x4

Post by iforgotmysocks »

UniTrader wrote:then you should look into these ideas:

effects may be a beginning, not really sure if they have such a function though
change Engines (define a new, slower type of them and swap temporaily when hit)


and i am sure there is another approach to this, too.
I thought about that too already but i didn't wanna believe that creating another engine macro for almost every kind of ship should be the only way, just to slow them down to a certain percentage. >.>

Effects... not sure, i'll check it out. :3 Though those are only for the 'pretty to look at' stuff. ^^
Well, i didn't come up with another one yet. :p

Thanks for your hints!
brammie
Posts: 100
Joined: Thu, 19. Dec 13, 23:26

Post by brammie »

iforgotmysocks wrote:Hm... thanks guys. :/
Thats exactly what i feared. ^^

Well, values received from macros seem to be read only properties and the only way to set them is using functions.
So... doing stuff like temporary altering values like weaponstrength, speed or whatever is not possible.
Which would be kinda ... lame.
Was trying to slow down a target after getting hit by a missile.
your misssing:

Code: Select all

scriptproperties.xml
the xsd define the xml language liek already a few replies higher, gget an xml edito, load up the xsd's and go make the scripts and validate befor deployying the mod...

the property file defines the different properties of objects,
eg

Code: Select all

  <datatype name="weapon" type="destructible">
    <property name="ammo.capacity" result="Amount of ammostorage this weapon adds to its destructible" type="integer" />
    <property name="ammo.macro" result="Macro of the used ammo" type="macro" />
    <property name="ammo.ware" result="Ware that can provide the used ammomacro" type="ware" />
  </datatype>
tells you you can set and get stuff by macro's

and in bullet_turret_medium_ml_macro.xml

Code: Select all

      <damage value="200" repair="0">
        <multiplier mining="100" />
      </damage>
gives you the standard when creating an new 'bullet_turret_medium_ml' instance in game (that can be altered later on by scripts)
iforgotmysocks
Posts: 1244
Joined: Fri, 8. Nov 13, 22:35
x4

Post by iforgotmysocks »

brammie wrote: your misssing:

Code: Select all

scriptproperties.xml
Am i? Why?
brammie wrote: the property file defines the different properties of objects,
Thats pretty clear, but it won't help me.

brammie wrote:

Code: Select all

  <datatype name="weapon" type="destructible">
    <property name="ammo.capacity" result="Amount of ammostorage this weapon adds to its destructible" type="integer" />
    <property name="ammo.macro" result="Macro of the used ammo" type="macro" />
    <property name="ammo.ware" result="Ware that can provide the used ammomacro" type="ware" />
  </datatype>
tells you you can set and get stuff by macro's
So can you tell me then how you can set those properties script-wise?
Because as far as i know you cannot set properties without functions. Adding new properties won't change that.
brammie wrote: and in bullet_turret_medium_ml_macro.xml

Code: Select all

      <damage value="200" repair="0">
        <multiplier mining="100" />
      </damage>
gives you the standard when creating an new 'bullet_turret_medium_ml' instance in game (that can be altered later on by scripts)
And this doesn't have anything to do with my problem. ^^
brammie
Posts: 100
Joined: Thu, 19. Dec 13, 23:26

Post by brammie »

basicly it tells you what you can use with "<set_value"
so "this.station.ammostorage.missile.count" can be set within a script
if "this" refers to a objeect connected to the station (manager for example)

if you wanne change the speed of a ship, you could use "this.velocity" but just need to figure out if its the ship you need to refer to or the engine it self
like this.ship.speed or this.ship.engine.speed (might be more "hops")

and yes, you need to check if the references you get at the start of the script are the 'actual' references or local copy's

at least thats how i understand how it works
iforgotmysocks
Posts: 1244
Joined: Fri, 8. Nov 13, 22:35
x4

Post by iforgotmysocks »

brammie wrote:at least thats how i understand how it works
But sadly that's not how it actually seems to work.
Nowhere in the whole gamecode is a property set without a function.

You can't address properties with <set_value>. Try and you'll get an error.
You can only address created variables and lists with <set_value>.

Could you give me an example doing it your way to proof me wrong?

Return to “X Rebirth - Scripts and Modding”