[SCRIPT] Ware notoriety checker v1.2 (6/21/07)

The place to discuss scripting and game modifications for X³: Reunion.

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

Post Reply
xfir01
Posts: 433
Joined: Sun, 13. May 07, 17:28
x3tc

[SCRIPT] Ware notoriety checker v1.2 (6/21/07)

Post by xfir01 » Wed, 16. May 07, 12:25

xfir.notor1.2.rar

***XTM USERS*** (version .7a)
XTM notoriety t file
XTM w/Ashley's factories t file


This returns the minimun notoriety need to buy a ware or the title assosiated with a given notoriety.

usage: call the script passing a ware, it'll return the notoriety needed as a number, or null if it doesn't recognize it.

call the script passing a number and a race, it'll return the title (i.e. "Federal Marshall") as a string, or null if given a race with no titles (like Xenon).


Fully compatible with X3 2.0.02 and EMP 2.01 (not required)



Changes:
1.2 6/21/07 - added ability to check notoriety of ships and stations. uploaded premade XTM t file, minor bug fix in t file builder.
1.1 Fixed a small error with unknown items returning 0 instead of null.

For modders:or mod users.

notoriety t file builder

Just put any modified Tfiles.txt in the same folder as this program and run it. If everything goes well it'll output a new 448382.xml with all the extra's you've added.

Or to do a single file, modify the Tfile.txt you want to extract (see readme to see how) then run it through
Notoriety Extractor
and add the values of the output file into the t file. (see its readme for more detailed instructions.)



Resources used:

t file 8382
page file 8382
Last edited by xfir01 on Thu, 21. Jun 07, 18:17, edited 9 times in total.

User avatar
al_main
Posts: 1379
Joined: Wed, 6. Oct 04, 10:26
x3

Post by al_main » Sat, 19. May 07, 14:59

Outstanding Work!

Cant believe that ES never added in a "get notoriety of ware" command in the Script Editor.

You've made an excellent tool here.

Squelch
Posts: 252
Joined: Sat, 15. May 04, 11:03
x2

Post by Squelch » Sat, 19. May 07, 15:27

Bravo!

This is just what is needed. I can now reduce the number of lines I used to do this in a convoluted way to a single library call. Spot on.

xfir01
Posts: 433
Joined: Sun, 13. May 07, 17:28
x3tc

Post by xfir01 » Sat, 19. May 07, 16:09

Squelch wrote:I can now reduce the number of lines I used to do this in a convoluted way to a single library call.
How did you used to do it?

Squelch
Posts: 252
Joined: Sat, 15. May 04, 11:03
x2

Post by Squelch » Sat, 19. May 07, 17:04

xfir01 wrote:How did you used to do it?
A set of hand crafted lookup tables as arrays - Yuk!

I'm almost too embarassed to admit to doing that, but you did ask. :oops:

xfir01
Posts: 433
Joined: Sun, 13. May 07, 17:28
x3tc

Post by xfir01 » Sun, 20. May 07, 02:05

1.1 Fixed a small error with unknown items returning 0 instead of null.

User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz » Sat, 11. Oct 08, 01:21

Guess I could create yet another post but... this does the same thing.
Well, without the limitations. =)

lib.gz.get.ware.notoriety
  • Arg1: Ware
  • Arg2: Buyer race or object
    Only used as "race" internally.
    If you supply any kind of object or sector, the race is extracted from that.

    If you supply a race/object for Buyer you also have to supply a value for seller.

    If the race/object is Player, the script returns null if the player can not afford 1 unit of Ware at average price.

    If you do not supply any values for Buyer or Seller, the default notoriety (as in TWares) is returned.
  • Arg3: Seller race or object
    Basically the same except...

    If you supply an existing station, the result is null if the station can not sell this ware or does not have any stock.

    Also, if the Buyer race/object is Player, the script returns null if the player can not afford 1 unit of Ware at the current price in this existing station.
  • Arg4: Mode
    String: "allowed" or null

    Returns 1
    if Buyer race/object is allowed to buy Ware at/from Seller race/object at the current notoriety.

    else returns null
  • RESULT
    If the library has to return a notoriety value it never returns a value below -999.
    Even though a ware can have such a low value, it's completely pointless because a minimum notoriety of -999 is required to dock anywhere in the game. (Minimum of -9 in core sectors)
This is a true library script and returns the actual min notoriety of any wares in your game regardless of how they were modded.
This is not just a long list of wares.
There is not a single ware entry in it so it returns the notoriety of all wares, ships, stations... whatever.
It's pure math and scans a range of over 1 million notoriety in 30-40 iterations.
In addition to that it is... fast.

[ external image ] (ZIP)

Code: Select all

@ $Noto = [THIS] -> call script 'lib.gz.get.ware.notoriety' :  
     Ware=Gamma Photon Pulse Cannon  
     Buyer race or object=null  
     Seller race or object=null  
     Mode=null

 ...returns 10000

$Ware =  get ware from maintype 7 and subtype 5
@ $Noto = [THIS] -> call script 'lib.gz.get.ware.notoriety' : Ware=$Ware
 ...returns 3333 (=Nova)

$Ware =  get ware from maintype 7 and subtype 24
 ...returns 100 (=Pericles)
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

TimeWalkersSight
Posts: 24
Joined: Fri, 25. Jul 08, 07:25

Post by TimeWalkersSight » Sat, 17. Jan 09, 09:36

So basically you buy the ware at the current notoriety. then you change the notoriety with a binary search till you see at what point its no longer possible to buy. then you reset the notoriety, readdd the ware at the station, subtract the ware from the ship and readd the money to your account.

Is it just me or is this a rather unconventional way of doing this? what happens if another script tries to buy something at exactly the same time?

Post Reply

Return to “X³: Reunion - Scripts and Modding”