[MOD] Shipyard and Player Shipyard - Ship recycling v0.07 (6 Apr 2017)

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

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

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Wed, 5. Apr 17, 16:49

Found the problem :-)

I use a call to lua function GetVersionString() to find the current version of the game to compensate for an issue where the number of parameters to AddUITriggeredEvent changes from 3.6 to 4.x

Code: Select all

local version = tonumber(string.sub(GetVersionString(), 7, 12))
which works fine when characters 7 to 12 are the version number which they are in the production version

But 4.1 RC3 is returning

4.10 Beta (232953) and the version is in characters 12 to 17

which upsets things and will also break several of my other mods that use the same compensating lua code

The good news is that when the Beta goes out of the version string then they "should" all work again :-)

Or I could change the code to compensate and maybe find what is between the () and ignore everything else or look in a different place when it sees Beta. Lots of ways to do this.

Hmmmm

Anybody have any strong opinions on the best way to go ?

jth
Last edited by jth on Wed, 5. Apr 17, 18:14, edited 3 times in total.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Wed, 5. Apr 17, 18:11

i would say using find to locate the brackets is the safest way for future compatibility (or maybe get the build number/Version Number of the Game directly, but i cannot access the function overview currently so no idea if there is such a function exists). But note i am not the best lua scripter around, in fact i consider myself crappy in this regard (i spent 3 weeks writing a Menu defined entirely via parameters to avoid having to mess with it too much in the future - this way i can define all Menus i could ever need entirely in MD :D )
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 ;)

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Wed, 5. Apr 17, 18:14

Thought I had a coded fix that grabbed what was between the brackets for a minute

Code: Select all

	local version = tonumber(string.sub(GetVersionString(), string.find(GetVersionString(), '(',1,true) + 1, string.find(GetVersionString(), ')',1,true) - 1))
then tried it on 4.00 and got

4.00 (208311 - 64-bit) as the version

I am definitely going off text strings for versions :-(

jth
EDIT
Changed it to six characters after the left bracket ...

Code: Select all

	local version = tonumber(string.sub(GetVersionString(), string.find(GetVersionString(), '(',1,true) + 1, string.find(GetVersionString(), '(',1,true) + 6))
Not particularly happy but it works on 4.00 now need to retest on 4.10 ...

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Thu, 6. Apr 17, 15:55

- [6.4.2017 - V0.07 Public Beta]
shiprecycle_menu_cost gui - Compensate for format of game version string changing in 4.10 RC3 and add extra paranoia when checking version to prevent crashing the GUI

User avatar
alexalsp
Posts: 1823
Joined: Fri, 18. Jul 14, 05:28
x4

Post by alexalsp » Thu, 14. Dec 17, 18:47

Mod works in XR 4.30. :)

Haribo187
Posts: 39
Joined: Fri, 8. Feb 08, 21:46
x4

updates

Post by Haribo187 » Sat, 3. Mar 18, 16:38

This program does not work as it is with updates,

:cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry:

Post Reply

Return to “X Rebirth - Scripts and Modding”