EnglishGermanFrenchRussianItalianSpanish
Log inRegister
 
[AL Plugin] Remove Prefix "Your" from Player Property
Post new topic Reply to topic Goto page 1, 2  Next
View previous topic :: View next topic
Author Message
Graxster





Joined: 14 Oct 2006
Posts: 814 on topic

Thank you for registering your game
PostPosted: Tue, 25. Nov 08, 08:22    Post subject: [AL Plugin] Remove Prefix "Your" from Player Property Reply with quote Print

Al Plugin: Auto-Rename Player Property

My first AL Plugin script, yay! Very Happy 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



RAR Archive



Back to top
View user's profile Send private message
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
PostPosted: Tue, 25. Nov 08, 13:19    Post subject: Reply with quote Print

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.


_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Back to top
View user's profile Send private message Visit poster's website
Graxster





Joined: 14 Oct 2006
Posts: 814 on topic

Thank you for registering your game
PostPosted: Tue, 25. Nov 08, 18:41    Post subject: Reply with quote Print

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

Back to top
View user's profile Send private message
Gazz





Joined: 13 Jan 2006
Posts: 12407 on topic
Location: Bavaria
Thank you for registering your game
PostPosted: Tue, 25. Nov 08, 19:41    Post subject: Reply with quote Print

Awell. I use a global renaming script anyway so I was just curious. =)


_________________
My complete script download page. . . . . . Xai-Corp MSCI List is scripter's friend. I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
Back to top
View user's profile Send private message Visit poster's website
amurph0



MEDALMEDALMEDAL

Joined: 16 Jun 2008
Posts: 715 on topic
Location: Ireland
Thank you for registering your game
PostPosted: Thu, 18. Dec 08, 04:45    Post subject: [SCRIPT] Custom prefix - HELP Reply with quote Print

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.


_________________
AeroCool Xpredator Black // AMD Phenom II 1090T 4.0GHz // H100 // ASUS ChIV Formula // 2x XFX Radeon 6870 Dual Fan // 4x2GB Patriot G-Series DDR3 1600MHz // Crucial M4 64Gb // 1TB Samsung F3 // Corsair HX1000W PSU
Back to top
View user's profile Send private message
Nividium





Joined: 21 Aug 2007



PostPosted: Thu, 18. Dec 08, 11:38    Post subject: Reply with quote Print

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

Back to top
View user's profile Send private message
amurph0



MEDALMEDALMEDAL

Joined: 16 Jun 2008
Posts: 715 on topic
Location: Ireland
Thank you for registering your game
PostPosted: Thu, 18. Dec 08, 19:10    Post subject: Reply with quote Print

Thanks Nividium.

How can i link this to the ship command menu. There is a tutorial for making commands somewhere ain't there?


_________________
AeroCool Xpredator Black // AMD Phenom II 1090T 4.0GHz // H100 // ASUS ChIV Formula // 2x XFX Radeon 6870 Dual Fan // 4x2GB Patriot G-Series DDR3 1600MHz // Crucial M4 64Gb // 1TB Samsung F3 // Corsair HX1000W PSU
Back to top
View user's profile Send private message
Neven87



MEDAL

Joined: 02 Dec 2005
Posts: 144 on topic

Thank you for registering your game
PostPosted: Thu, 18. Dec 08, 23:17    Post subject: Reply with quote Print

for those of us who scripting retarded where would i throw this?

Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
jlehtone



MEDALMEDALMEDAL

Joined: 23 Apr 2005
Posts: 16874 on topic
Location: GalNet BBS
Thank you for registering your game
PostPosted: Thu, 18. Dec 08, 23:29    Post subject: Re: [SCRIPT] Custom prefix - HELP Reply with quote Print

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.

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.

Back to top
View user's profile Send private message
Nividium





Joined: 21 Aug 2007



modified
PostPosted: Fri, 19. Dec 08, 01:20    Post subject: Reply with quote Print

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?


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.

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:

<?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>


Your setup file needs to point to your main script and uses the t-file to bind the command button to your main script. So, put in something like this: (then save the file as setup.name.prefix)

Code:
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, 15:18; edited 1 time in total
Back to top
View user's profile Send private message
amurph0



MEDALMEDALMEDAL

Joined: 16 Jun 2008
Posts: 715 on topic
Location: Ireland
Thank you for registering your game
PostPosted: Fri, 19. Dec 08, 02:56    Post subject: Reply with quote Print

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


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


_________________
AeroCool Xpredator Black // AMD Phenom II 1090T 4.0GHz // H100 // ASUS ChIV Formula // 2x XFX Radeon 6870 Dual Fan // 4x2GB Patriot G-Series DDR3 1600MHz // Crucial M4 64Gb // 1TB Samsung F3 // Corsair HX1000W PSU
Back to top
View user's profile Send private message
Nividium





Joined: 21 Aug 2007



PostPosted: Fri, 19. Dec 08, 04:32    Post subject: Reply with quote Print

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


From within the Script Editor go to [General Commands] [Arrays] Then look at the 2nd command on list ie:

<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.

Back to top
View user's profile Send private message
amurph0



MEDALMEDALMEDAL

Joined: 16 Jun 2008
Posts: 715 on topic
Location: Ireland
Thank you for registering your game
PostPosted: Fri, 19. Dec 08, 18:39    Post subject: Reply with quote Print

Thanks again Nividium


_________________
AeroCool Xpredator Black // AMD Phenom II 1090T 4.0GHz // H100 // ASUS ChIV Formula // 2x XFX Radeon 6870 Dual Fan // 4x2GB Patriot G-Series DDR3 1600MHz // Crucial M4 64Gb // 1TB Samsung F3 // Corsair HX1000W PSU
Back to top
View user's profile Send private message
Sticks





Joined: 29 Nov 2007
Posts: 214 on topic

Thank you for registering your game
PostPosted: Sun, 21. Dec 08, 14:30    Post subject: Reply with quote Print

Hi, can you upload this script please? I'm to dumb to write it myself ...

Back to top
View user's profile Send private message
amurph0



MEDALMEDALMEDAL

Joined: 16 Jun 2008
Posts: 715 on topic
Location: Ireland
Thank you for registering your game
PostPosted: Sun, 21. Dec 08, 19:26    Post subject: Reply with quote Print

All credit goes to Nvidium:

Custom Prefix:
SPK: http://files.filefront.com/Custom+Prefixspk/;12725520;/fileinfo.html

Non-SPK: http://files.filefront.com/Custom+Prefixrar/;12725519;/fileinfo.html


_________________
AeroCool Xpredator Black // AMD Phenom II 1090T 4.0GHz // H100 // ASUS ChIV Formula // 2x XFX Radeon 6870 Dual Fan // 4x2GB Patriot G-Series DDR3 1600MHz // Crucial M4 64Gb // 1TB Samsung F3 // Corsair HX1000W PSU
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic Reply to topic Goto page 1, 2  Next
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Control Panel
Login Data
The time now is Wed, 13. Dec 17, 16:51

All times are GMT + 2 Hours


Board Security

Copyright © EGOSOFT 1989-2017
Powered by phpBB © 2001, 2005 phpBB Group
Template created by Avatar & BurnIt!
Debug: page generation = 0.10652 seconds, sql queries = 29