Page 1 of 1

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

Posted: Wed, 16. May 07, 12:25
by xfir01
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

Posted: Sat, 19. May 07, 14:59
by al_main
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.

Posted: Sat, 19. May 07, 15:27
by Squelch
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.

Posted: Sat, 19. May 07, 16:09
by xfir01
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?

Posted: Sat, 19. May 07, 17:04
by Squelch
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:

Posted: Sun, 20. May 07, 02:05
by xfir01
1.1 Fixed a small error with unknown items returning 0 instead of null.

Posted: Sat, 11. Oct 08, 01:21
by Gazz
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.

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)

Posted: Sat, 17. Jan 09, 10:36
by TimeWalkersSight
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?