Guys, How do i convert a floating value to integer in xml scipts?
<set_value name="$intvalue" exact="(int)$floatvalue"/>
or
<set_value name="$intvalue" exact="floor($floatvalue)"/>
or
... ?
I want to get rid of the fractional part.
[Help] How to convert numbers
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 478
- Joined: Sun, 25. May 14, 17:45
-
- Posts: 391
- Joined: Sun, 9. Nov 08, 03:07
Re: [Index] X4: Foundations Tools, Tutorials and Resources
a trailing i, or f for float.
($floatvalue)i
i.e. (player.money/$cost)i
-
- Posts: 478
- Joined: Sun, 25. May 14, 17:45
Re: [Index] X4: Foundations Tools, Tutorials and Resources
-
- Posts: 47
- Joined: Wed, 24. Feb 16, 05:23
Re: [Index] X4: Foundations Tools, Tutorials and Resources
Are the xml schema the only source for such information as described above? When I discovered that values could be cast with trailing letters that look like identifiers I was so annoyed that I initially named that token group "stupid_inexplicable_trailing_f" in my little translator thingy.
-
- Posts: 478
- Joined: Sun, 25. May 14, 17:45
Re: [Index] X4: Foundations Tools, Tutorials and Resources
Those 'special' inexplicable tricks take quite a bit of effort to find, understand and successfully use them by trial/error. Your best bet is to ask here or to go through line by line the original scripts in hope to find what you are looking for.StopBanningMe7_III wrote: ↑Mon, 17. Dec 18, 01:49 Are the xml schema the only source for such information as described above? When I discovered that values could be cast with trailing letters that look like identifiers I was so annoyed that I initially named that token group "stupid_inexplicable_trailing_f" in my little translator thingy.
Semantics for certain commands would require much more explanation to understand. I would like EGO to focus on fixing pathfinding first before spending time with documentation

-
- Posts: 47
- Joined: Wed, 24. Feb 16, 05:23
Re: [Index] X4: Foundations Tools, Tutorials and Resources
Line by line by hand? Yeah... no.Assailer wrote: ↑Mon, 17. Dec 18, 05:33Those 'special' inexplicable tricks take quite a bit of effort to find, understand and successfully use them by trial/error. Your best bet is to ask here or to go through line by line the original scripts in hope to find what you are looking for.StopBanningMe7_III wrote: ↑Mon, 17. Dec 18, 01:49 Are the xml schema the only source for such information as described above? When I discovered that values could be cast with trailing letters that look like identifiers I was so annoyed that I initially named that token group "stupid_inexplicable_trailing_f" in my little translator thingy.
Semantics for certain commands would require much more explanation to understand. I would like EGO to focus on fixing pathfinding first before spending time with documentation![]()
As with all other problems in life, PERL TO THE RESCUE! Or maybe a library to extract grammars from xml files. That might work better.
I'll see if I can extract a full grammar for the language and post it here. I'm tired of not knowing how on earth to even start writing a mod.
(2 minutes later) EDIT: Here's a dump out of some of the core of the language. Pretty crude and only marginally useful, but at least it does give a list of a lot of the more complicated commands, and details what parameters the more basic commands take.
https://pastebin.com/raw/JxBFRRKa
-
- Moderator (Script&Mod)
- Posts: 13489
- Joined: Sun, 15. Feb 04, 20:12
Re: [Help] How to convert numbers
Topic split and title adjusted.
For basics in scripting (XML and MD) please check the very first link in this sticky.
Cheers Euclid
For basics in scripting (XML and MD) please check the very first link in this sticky.
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
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786