[AL Plugin] Remove Prefix "Your" from Player Property
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
[AL Plugin] Remove Prefix "Your" from Player Property
Al Plugin: Auto-Rename Player Property
My first AL Plugin script, yay! Big thanks to LV for adding copious amounts of comments to his Medusa Rapid Fire Missile Interface AL Plugin script. Couldn't have figured it out without those. Thanks LV!
Anyway... this little AL Plugin will automatically rename all your ships and stations, removing the prefix "Your" from the names. It defaults to ON when you load your save. If you want to turn it off, go to Gameplay > Artificial Life Settings. It checks all your ships and stations once every 5 seconds or so, so you will see "Your" once in a while, but not for very long. Enjoy!
-Grax
SPK
[ external image ]
RAR Archive
[ external image ]
My first AL Plugin script, yay! Big thanks to LV for adding copious amounts of comments to his Medusa Rapid Fire Missile Interface AL Plugin script. Couldn't have figured it out without those. Thanks LV!
Anyway... this little AL Plugin will automatically rename all your ships and stations, removing the prefix "Your" from the names. It defaults to ON when you load your save. If you want to turn it off, go to Gameplay > Artificial Life Settings. It checks all your ships and stations once every 5 seconds or so, so you will see "Your" once in a while, but not for very long. Enjoy!
-Grax
SPK
[ external image ]
RAR Archive
[ external image ]
Have you considered making this a simple text file hack like your last?
This should be even more effective and without any overhead or background tasks.
It wouldn't work on existing objectss, of course.
This should be even more effective and without any overhead or background tasks.
It wouldn't work on existing objectss, of course.
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.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
That was my first idea, but the game didn't like me playing around with that stuff. I was able to get to a point where ships didn't have "Your", but when I attempted stations, any station built had no name at all. Tried about 6 different ways to get it to work, all with no success. Gave up and wrote this instead. Adding "Your" is a hardcoded event, so if it doesn't get what it's expecting, it wigs out, I guess. I'll look at it again some other time.
-Grax
-Grax
Awell. I use a global renaming script anyway so I was just curious. =)
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.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
[SCRIPT] Custom prefix - HELP
I want to make a script that allows you to use a custom prefix for your ships, and automatically rename them for you.
I'm not talking about the other scripts that automatically add the name of the ships homebase or type of factory it's assigned to or anything like that.
I want the script to prompt you for a prefix that you type in and the script inserts it into the names of all your ships
e.g.
I buy 10 Scimitars, they're all called "Your Scimitar".
I want it to auto rename them all to something like "EireCo Scimitar".
So the names will be like the names of the ships from NPC companies eg "TerraCorp Mercury" or "Strong Arms Mamba".
I only want the script to rename ships as station names may be different, like a ship may use a shorter name or abbreviation while the station uses a full name. So i'd prefer if station names are untouched.
If anyone can help me make this script, or point me to an existing one i'd appreciate it.
Thank in advance.
I'm not talking about the other scripts that automatically add the name of the ships homebase or type of factory it's assigned to or anything like that.
I want the script to prompt you for a prefix that you type in and the script inserts it into the names of all your ships
e.g.
I buy 10 Scimitars, they're all called "Your Scimitar".
I want it to auto rename them all to something like "EireCo Scimitar".
So the names will be like the names of the ships from NPC companies eg "TerraCorp Mercury" or "Strong Arms Mamba".
I only want the script to rename ships as station names may be different, like a ship may use a shorter name or abbreviation while the station uses a full name. So i'd prefer if station names are untouched.
If anyone can help me make this script, or point me to an existing one i'd appreciate it.
Thank in advance.
Corsair 400c // Intel i7 8700k // H100i v2 // ASUS Maximus X Code // ASUS 1080ti Strix OC // 2x8GB Corsair Vengeance 3200MHz // Samsung 960 Evo 250GB // 960GB SanDisk Ultra II // Corsair RM850i
Script a.temp
Version: 0
for Script Engine Version: 42
Description
Description
Arguments
1: prefix , String , 'type in Prefix'
Source Text
001 $ship.array = get ship array: of race Player class/type=Moveable Ship
002 $ship.array.size = size of array $ship.array
003 while $ship.array.size > 0
004 |dec $ship.array.size =
005 |$ship = $ship.array[$ship.array.size]
006 |$wtc = $ship -> get ware type code of object
007 |$new.name = $prefix + ' ' + $wtc
008 |$ship -> set name to $new.name
009 @ |= wait 1 ms
010 end
011 return null
Version: 0
for Script Engine Version: 42
Description
Description
Arguments
1: prefix , String , 'type in Prefix'
Source Text
001 $ship.array = get ship array: of race Player class/type=Moveable Ship
002 $ship.array.size = size of array $ship.array
003 while $ship.array.size > 0
004 |dec $ship.array.size =
005 |$ship = $ship.array[$ship.array.size]
006 |$wtc = $ship -> get ware type code of object
007 |$new.name = $prefix + ' ' + $wtc
008 |$ship -> set name to $new.name
009 @ |= wait 1 ms
010 end
011 return null
Thanks Nividium.
How can i link this to the ship command menu. There is a tutorial for making commands somewhere ain't there?
How can i link this to the ship command menu. There is a tutorial for making commands somewhere ain't there?
Corsair 400c // Intel i7 8700k // H100i v2 // ASUS Maximus X Code // ASUS 1080ti Strix OC // 2x8GB Corsair Vengeance 3200MHz // Samsung 960 Evo 250GB // 960GB SanDisk Ultra II // Corsair RM850i
Re: [SCRIPT] Custom prefix - HELP
Rather than reinventing wheel, take an exiting solution and either ask the author to make it more versatile or adjust it yourself. Threads merged in hopes of creating a tiny bit of synergy.amurph0 wrote:I want to make a script that allows you to use a custom prefix for your ships, and automatically rename them for you.
To create and link a command to a script, you need to create a t-file and a setup script. The t-file creates the button ie command that shows up on a ships command menu and the setup script links the command to the main script or points to it for execution.amurph0 wrote:Thanks Nividium.
How can i link this to the ship command menu. There is a tutorial for making commands somewhere ain't there?
Your t-file should contain the following code: (substitute the <t id with one that is available within the "custom", "special" or "general command slots etc, see list). Then save the t-file, check for an available number in the list ie: 7095-L044.xml.
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<language id="44">
<!-- Setup Name Prefix Command Button Slot -->
<page id="2008" title="Script Object Commands" descr="">
<t id="857">COMMAND_NAME_PREFIX</t>
</page>
<page id="2010" title="Script Cmd Names" descr="">
<t id="857">Name Prefix</t>
</page>
<page id="2011" title="Script Cmd Shorts" descr="">
<t id="857">NP</t>
</page>
<page id="2022" title="Command Info" descr="">
<t id="857">This area is used for a description text for when the player presses the i key. Put what you want in here.\n</t>
</page>
</language>
Code: Select all
001 load text: id=7095
002 global script map: set: key=COMMAND_TYPE_GENERAL_57, class=Moveable Ship, race=Player, script='my.main.script.file.name', prio=0
003 set script command upgrade: command=COMMAND_TYPE_GENERAL_57 upgrade=[true]
004 return null
Last edited by Nividium on Sun, 21. Dec 08, 14:18, edited 1 time in total.
I'm having trouble with lines 005 and 007. I don't know how to enter $ship.array[$ship.array.size]Nividium wrote:Script a.temp
Version: 0
for Script Engine Version: 42
Description
Description
Arguments
1: prefix , String , 'type in Prefix'
Source Text
001 $ship.array = get ship array: of race Player class/type=Moveable Ship
002 $ship.array.size = size of array $ship.array
003 while $ship.array.size > 0
004 |dec $ship.array.size =
005 |$ship = $ship.array[$ship.array.size]
006 |$wtc = $ship -> get ware type code of object
007 |$new.name = $prefix + ' ' + $wtc
008 |$ship -> set name to $new.name
009 @ |= wait 1 ms
010 end
011 return null
And the + ' ' + in line 007
Both are giving Syntax error or somthing
Corsair 400c // Intel i7 8700k // H100i v2 // ASUS Maximus X Code // ASUS 1080ti Strix OC // 2x8GB Corsair Vengeance 3200MHz // Samsung 960 Evo 250GB // 960GB SanDisk Ultra II // Corsair RM850i
From within the Script Editor go to [General Commands] [Arrays] Then look at the 2nd command on list ie:amurph0 wrote: I'm having trouble with lines 005 and 007. I don't know how to enter $ship.array[$ship.array.size]
And the + ' ' + in line 007
Both are giving Syntax error or somthing
<RetVar/If><Var/Array>[<Var/Number>]
For the line 007, just use the space bar to insert a blank line. The script editor will add the ' ' all by itself to indicate it is a string. Use the <string> there to insert the blank spacer line.
All credit goes to Nvidium:
Custom Prefix:
SPK: http://files.filefront.com/Custom+Prefi ... einfo.html
Non-SPK: http://files.filefront.com/Custom+Prefi ... einfo.html
Custom Prefix:
SPK: http://files.filefront.com/Custom+Prefi ... einfo.html
Non-SPK: http://files.filefront.com/Custom+Prefi ... einfo.html
Corsair 400c // Intel i7 8700k // H100i v2 // ASUS Maximus X Code // ASUS 1080ti Strix OC // 2x8GB Corsair Vengeance 3200MHz // Samsung 960 Evo 250GB // 960GB SanDisk Ultra II // Corsair RM850i
- Sandalpocalypse
- Posts: 4447
- Joined: Tue, 2. Dec 03, 22:28
-
- Posts: 25
- Joined: Wed, 18. Feb 04, 18:58
I tried to change the script to my needs, but i somehow don`t get it to work. Can anybody help me? (Probably something wrong with the "if $ship == Class/Object"-conditions.)
Code: Select all
001 $plugin.data = get global variable: name=$plugin.ID
002 if not $plugin.data
003 |$plugin.data = array alloc: size=2
004 |set global variable: name=$plugin.ID value=$plugin.data
005 |$plugin.data[0] = 0
006 |$plugin.data[1] = [TRUE]
007 end
008 if $plugin.event == 'init' OR $plugin.event == 'reinit'
009 |al engine: set plugin $plugin.ID description to 'Auto-Rename Player Property'
010 |$timer = 60
011 |al engine: set plugin $plugin.ID timer interval to $timer s
012 else if $plugin.event == 'isenabled'
013 |$retvar = $plugin.data[1]
014 |return $retvar
015 else if $plugin.event == 'start'
016 |$plugin.data[1] = [TRUE]
017 else if $plugin.event == 'stop'
018 |$plugin.data[1] = [FALSE]
019 else if $plugin.event == 'timer'
020 |if $plugin.data[1]
021 ||$ship.array = get ship array: of race Player class/type=Schiff
022 ||$n = size of array $ship.array
023 ||while $n
024 |||dec $n =
025 |||$ship = $ship.array[$n]
026 |||$name = $ship -> get name
027 |||$sub = get substring of $name offset=0 length=3
028 |||if $sub == 'Ihr'
029 ||||$sub1 = get substring of $name offset=4 length=99
030 ||||if $ship == TL
031 |||||$newname = 'TL' + ' ' + $sub1
032 |||||$ship -> set name to $newname
033 ||||else if $ship == M1
034 |||||$newname = 'M1' + ' ' + $sub1
035 |||||$ship -> set name to $newname
036 ||||else if $ship == M2
037 |||||$newname = 'M2' + ' ' + $sub1
038 |||||$ship -> set name to $newname
039 ||||else if $ship == M3
040 |||||$newname = 'M3' + ' ' + $sub1
041 |||||$ship -> set name to $newname
042 ||||else if $ship == M4
043 |||||$newname = 'M4' + ' ' + $sub1
044 |||||$ship -> set name to $newname
045 ||||else if $ship == M5
046 |||||$newname = 'M5' + ' ' + $sub1
047 |||||$ship -> set name to $newname
048 ||||else if $ship == M6
049 |||||$newname = 'M6' + ' ' + $sub1
050 |||||$ship -> set name to $newname
051 ||||else if $ship == M7
052 |||||$newname = 'M7' + ' ' + $sub1
053 |||||$ship -> set name to $newname
054 ||||else if $ship == M8
055 |||||$newname = 'M8' + ' ' + $sub1
056 |||||$ship -> set name to $newname
057 ||||else if $ship == TS
058 |||||$newname = 'TS' + ' ' + $sub1
059 |||||$ship -> set name to $newname
060 ||||else if $ship == TP
061 |||||$newname = 'TP' + ' ' + $sub1
062 |||||$ship -> set name to $newname
063 ||||else if $ship == TM
064 |||||$newname = 'TM' + ' ' + $sub1
065 |||||$ship -> set name to $newname
066 ||||else if $ship == Schiff
067 |||||$newname = $sub1
068 |||||$ship -> set name to $newname
069 ||||end
070 |||end
071 ||end
072 ||$station.array = get station array: of race Player class/type=Station
073 ||$n = size of array $station.array
074 ||while $n
075 |||dec $n =
076 |||$station = $station.array[$n]
077 |||$name = $station -> get name
078 |||$sub = get substring of $name offset=0 length=3
079 |||if $sub == 'Ihr'
080 ||||$sub1 = get substring of $name offset=4 length=99
081 ||||$station -> set name to $sub1
082 |||end
083 ||end
084 |end
085 end
086 return null