Bridge Commander Central

BC Forums => BC Scripting => Topic started by: vonfrank on October 15, 2010, 07:21:09 PM

Title: Added Ship Name
Post by: vonfrank on October 15, 2010, 07:21:09 PM
When I add a ship into a map through the "Add Ship" function (NOT the Quick Battle Setup!!!) the name of the ship comes up as the name of the ship file instead of the proper name.

Is there some way to get the "Add Ship" function to use the proper name of the ship instead of the name of the ship in the files?
Title: Re: Added Ship Name
Post by: King Class Scout on October 15, 2010, 08:15:08 PM
some guys don't use the actuall name of the ship in the ship file, but the name of the type, instead.  you'd have to manually rewrite the "ship" file to use the name in the registry.
Title: Re: Added Ship Name
Post by: vonfrank on October 16, 2010, 02:41:41 PM
UUGG!  :banghead:

I was hoping that there was a much simpler way to do it. A lot of things need to be changed to re write the ship file.
Title: Re: Added Ship Name
Post by: JimmyB76 on October 16, 2010, 03:05:57 PM
are you talking about name of the ship meaning "USS Blahblahblah" instead of how it appears in the QB ship menu?
Title: Re: Added Ship Name
Post by: King Class Scout on October 16, 2010, 06:52:39 PM
I assumed he meant the default name in the "Longname" entry in the (corrected refrence) Plugin

for example

Code: [Select]
abbrev = 'Accuser'
iconName = 'Accuser'
longName = 'DN Accuser'
shipFile = 'Accuser'

Longname is the one that appears in the menu selection and as the opponent name on the actual battle screen.
Title: Re: Added Ship Name
Post by: JimmyB76 on October 16, 2010, 07:42:28 PM
right...  but when using AddShips, the name as it appears in the HUD (friendly/enemy) is not the QB menu name and is replaced by a random name such as "USS Blahblahblah" or "IKS Something" and such...
if i recall correctly, having "Use Ship Names" (or whatever it is called) option turned off will have it show the name of the ship file tho it has been a long time since ive used AddShips...  
where i was going with my post was that there is a thread i can link to; i asked a question along these lines 2 years ago at BCS as far as having the longname show instead: http://bcs-tng.com/forums/index.php?topic=2127.0
Title: Re: Added Ship Name
Post by: vonfrank on October 17, 2010, 06:23:08 PM
Ah Ha! that did it!  :yay:

I looked into that thread deeper and found my exact problem.

in regards to the AddShips and the new Random Battles mod from cnotsch, when the ships are added into the game (either by selection from AddShips or randomly) they will appear in your targets list with the ships listed as the filename in scripts/ships... 
(altho i havent used the AddShips function in a long time, i am 99% sure it does this)

for example, if i have a Dominion Battlecruiser whose longName is as such, the ship's script however is listed as DomBC...  so when that ship is added ingame it is listed as "DomBC" instead of the ship's longName...

is there something i can add into those two scripts that would have the ship's longName be listed instead of the ship's script name? (unless it is listed above already and im just blind as a bat lol)

find in addshipgui

Code: [Select]
def addshiphelper(pObject, pEvent):
        debug(__name__ + ", addshiphelper")
        global ships_list, groupFriendly, groupEnemy, groupNeutral
        for i in groupFriendly.keys():
                ship = ships_list[groupFriendly[i]][0]
                #print("add friendly: %s") % (ship)
                if useNames:
                        sShipName = GetRandomNameFor(ship)
                        addship.friendly(ship, Name = sShipName)
                else:
                        addship.friendly(ship)
        for i in groupEnemy.keys():
                ship = ships_list[groupEnemy[i]][0]
                #print("add enemy: %s") % (ship)
                if useNames:
                        sShipName = GetRandomNameFor(ship)
                        addship.enemy(ship, Name = sShipName)
                else:
                        addship.enemy(ship)
        for i in groupNeutral.keys():
                ship = ships_list[groupNeutral[i]][0]
                #print("add neutral: %s") % (ship)
                if useNames:
                        sShipName = GetRandomNameFor(ship)
                        addship.neutral(ship, Name = sShipName)
                else:
                        addship.neutral(ship)
        groupFriendly = {}
        groupEnemy = {}
        groupNeutral = {}
        RebuildEnemyMenu()
        RebuildFriendlyMenu()
        RebuildNeutralMenu()
        AddShips(pObject, pEvent)

replace with

Code: [Select]
def addshiphelper(pObject, pEvent):
        # debug(__name__ + ", addshiphelper")
        global ships_list, groupFriendly, groupEnemy, groupNeutral
        for i in groupFriendly.keys():
                sName = ships_list[groupFriendly[i]][1]
                ship = ships_list[groupFriendly[i]][0]
                #print("add friendly: %s") % (ship)
                if useNames:
                        sShipName = GetRandomNameFor(ship)
                        addship.friendly(ship, Name = sShipName)
                else:
                        addship.friendly(ship, sName)
        for i in groupEnemy.keys():
                sName = ships_list[groupEnemy[i]][1]
                ship = ships_list[groupEnemy[i]][0]
                #print("add enemy: %s") % (ship)
                if useNames:
                        sShipName = GetRandomNameFor(ship)
                        addship.enemy(ship, Name = sShipName)
                else:
                        addship.enemy(ship, sName)
        for i in groupNeutral.keys():
                sName = ships_list[groupNeutral[i]][1]
                ship = ships_list[groupNeutral[i]][0]
                #print("add neutral: %s") % (ship)
                if useNames:
                        sShipName = GetRandomNameFor(ship)
                        addship.neutral(ship, Name = sShipName)
                else:
                        addship.neutral(ship, sName)
        groupFriendly = {}
        groupEnemy = {}
        groupNeutral = {}
        RebuildEnemyMenu()
        RebuildFriendlyMenu()
        RebuildNeutralMenu()
        AddShips(pObject, pEvent)


(jb76 edit - fixed code tags)