EnglishGermanFrenchRussianPolishItalianSpanish
Log inRegister
 
[SCRIPT]Station Freight Transporter v2.1.2 - 06/05/07
Post new topic Reply to topic
View previous topic :: View next topic

How is this script
Excellent
57%
 57%  [ 4 ]
Good
28%
 28%  [ 2 ]
OK
0%
 0%  [ 0 ]
Not good
14%
 14%  [ 1 ]
Rubbish
0%
 0%  [ 0 ]
Total Votes : 7

Author Message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
modified
PostPosted: Sun, 22. Apr 07, 23:56    Post subject: [SCRIPT]Station Freight Transporter v2.1.2 - 06/05/07 Reply with quote Print

Station Freight Transporter V2.1.2
-------------------------------------

When activated from your trade station's command menu, this script will transfer products from player owned stations to other player owned stations in the sector that requires them as a resource. There is a 100,000cr activation fee every time the script is activated, as well as an additional fee for every unit of product transferred.


To use:
--------
Only available on Trading Stations, Equipment Docks and the PHQ
First ensure the trade station has a (recommended) minimum of 1,000,000 cr, then select 'Station Commands>SFS'
You will be asked 2 questions. The first is to determine the maximum range the station should transport goods from/to, so if you only want stations within your small loop to transfer between themselves and not transfer to your other stations in the sector, type something small like 10-15 (distances in Km). If you want your stations to transfer between all of your other stations in the sector, type a suitably large number, eg. 1000 to encompass the whole sector.
The second is how many goods the station should retain, in %, either for trading with free traders or for stockpiling purposes.

*Note* The charge for transferring products is now 5% of the wares average price (1cr min) * (distance from sending station). This means that although you set the max range to 1000 to encompass the whole sector, if the station is only 50Km away the cost per unit transferred will be (5% * 50).

*Note 2* Although I am working on a way to be able to change the values without being charged, I have so far been unable to to so Sad this means you will have to restart the script (and therefore pay another 100,000cr) but I'll keep looking into it for the next release Smile


The script transfers every 5 seconds (so it shouldn't massively slow down with lots of stations), if you want to change it the wait time is in 'HI.StationFreightTransporter' on line 1.


Link to my script:
http://www.xai-corp.net/en/files/xaicorp/projects/releases/SFT-V2.1.2.spk


Changelog:
-------------
2.1.2
Added a list of stations in range to the incomming message.

2.1.1
Working release.

2.1BETA
Further code refinements, only released so I could get help fixing a few little bugs

2.0BETA
Major update, command now only available on trade docks/PHQ
Arguement added for % ware to be retained
Pricing now 5% * dist per unit transferred, only charged for goods going from producing station to trade dock
Small code refinements
**Didn't work as planned, note the BETA**

1.2.1
Small update, now the command is visible when running from the station command menu.

1.2
Added a distance arguement to set the max distance for transfer,
Changed the pricing from 1cr/unit to 1%/unit * dist

1.1
A few code updates,
Small alterations to the text file,
No longer BETA

1.0
Initial BETA release


Possible Additions:
Arrow Add support for hubs and therefore multiple product wares. [Should be ok now..]
Arrow Question to allow player to change Max distance and Stored % without having to pay again


Thanks and look forward to your replies Smile

-------------------------------------------
Resources Used
-------------------
Text file: 7666
Command slot: COMMAND_TYPE_STATION_40

Special thanks:
------------------
Tomcat: he began this script, I'm just changing it a bit. Original script here: http://forum.egosoft.com/viewtopic.php?t=125074
B-O'F: For help with the code when I made stupid mistakes Razz and basically writing the script for me...ahem



Last edited by Heretic666 on Sun, 6. May 07, 16:39; edited 14 times in total
Back to top
View user's profile Send private message
B-O'F





Joined: 21 Feb 2004
Posts: 719 on topic

Thank you for registering your game
PostPosted: Mon, 23. Apr 07, 00:38    Post subject: Reply with quote Print

Hi Heretic666,

Just had a quick look through your script, and I think I have spotted the reasons for your problems:-

Line 29 needs a few things:-
Set 'Asked' to null, as is still set from earlier (lines 12-20)

Need to re-check $StationMoney - you have only checked it before taking anything out - it has not been updated.

Also need to re-check $FactoryArraySize, as you decrement it in line 41, and is currently zero - so will do nothing after the first run through.

I would suggest that you re-get the Factory Array to allow for new stations being added

Also need lines 31 to 37 in a loop to await reply - as in lines 12-20


I am not saying that these are your only errors - I only had a quick look to try and spot your listed problems.

See what happens after these changes,

Boron - Ol Fh'art


_________________
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.
Back to top
View user's profile Send private message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
PostPosted: Mon, 23. Apr 07, 01:57    Post subject: Reply with quote Print

Yeah I thought it would be something small and stupid, I've implemented the changes you suggested and it seems to be working fine, I'll be leaving it on overnight to try and fill an energy loop, I'll see what happens and if it works post an updated version.

One small thing:

Code:
037   while $StationMoney == 0
038    $Var1 = [THIS] -> get local variable: name='Asked'
039    if not $Var1
040     [THIS] -> set local variable: name='Asked' value=[TRUE]
041     $Msg3 = sprintf: pageid=7666 textid=3, $StationName, $StationSec, null, null, null
042     send incoming message $Msg3 to player: display it=[TRUE]
043    end
044 @  = wait 10 ms
045   end


This part is supposed to loop while the station has no money, but continue when the station has money again. However it seems only to send the message telling the player there is no money, it doesn't seem to carry on after money is added to the station. Any ideas why?

[EDIT] I should say that the variable 'Asked' has already been set to null before this point (thanks for that do'h!)

Back to top
View user's profile Send private message
B-O'F





Joined: 21 Feb 2004
Posts: 719 on topic

Thank you for registering your game
PostPosted: Mon, 23. Apr 07, 11:40    Post subject: Reply with quote Print

Hi Heretic666,

Glad I could hep with your questions, most scripting errors are of the 'small and stupid' type - I know, we all make them at some time or other.

As to your current problem - same type....

Look at your loop - it is While money == 0... where do you check the money ? Before the loop starts.. you need to re-check the money - I suggest at line 44, before the wait.

'Asked' is just to stop spamming the message - it has nothing to do with the money.....

Boron - Ol Fh'art


_________________
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.
Back to top
View user's profile Send private message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
modified
PostPosted: Mon, 23. Apr 07, 13:12    Post subject: Reply with quote Print

lol Razz

sorted now heh


UPDATED TO V1.1
See first post.



Last edited by Heretic666 on Wed, 25. Apr 07, 18:55; edited 1 time in total
Back to top
View user's profile Send private message
B-O'F





Joined: 21 Feb 2004
Posts: 719 on topic

Thank you for registering your game
PostPosted: Mon, 23. Apr 07, 13:23    Post subject: Reply with quote Print

Hi Heretic666,

Glad to hear that you are now sorted out.

For hosting, have a look at Xai Corporation - it is run by Moggy2.. you can PM him to get the details (see his sig.) This is an interesting site, lots of good info, and - most importantly - most of my scripts... and lots of good scripts as well. (you can read this last sentence any way you wish).

Enjoy, and learn,

Boron - Ol Fh'art


_________________
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.
Back to top
View user's profile Send private message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
PostPosted: Mon, 23. Apr 07, 18:11    Post subject: Reply with quote Print

Changed the download link, thanks to moggy2 and Xai Corp for that Smile


_________________
Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..
Back to top
View user's profile Send private message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
PostPosted: Wed, 25. Apr 07, 18:55    Post subject: Reply with quote Print

UPDATED TO V1.2
See first post for link.

Changes:
Added a distance arguement to set the max distance for transfer,
Changed the pricing from 1cr/unit to 1%/unit * dist


_________________
Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..
Back to top
View user's profile Send private message
Schabernack





Joined: 18 Apr 2007

Location: Nürnberg

PostPosted: Thu, 26. Apr 07, 19:58    Post subject: Reply with quote Print

Only the resources of a station or their products, too?

Is it possible to transfer multiple wares from one station to another?

Is it possible to transfer from a hub to a hq?


solong


_________________
learn from the past, live the moment, dream of the future
***modified*** eh klar
Back to top
View user's profile Send private message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
PostPosted: Thu, 26. Apr 07, 20:29    Post subject: Reply with quote Print

Schabernack wrote:
Only the resources of a station or their products, too?

Is it possible to transfer multiple wares from one station to another?

Is it possible to transfer from a hub to a hq?


solong


1 Arrow It transfers the product of the station you activate it on to any other station within range that uses that product.

eg. If you activate it on an SPP, it will transfer energy cells to every station that uses them within range.


2 Arrow Not as yet, but I'll put it onto the 'todo' list


3 Arrow Not looked into that, but once I put your other idea into it I'll test it out, cant see why it wouldn't though..


_________________
Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..
Back to top
View user's profile Send private message
Schabernack





Joined: 18 Apr 2007

Location: Nürnberg

PostPosted: Fri, 27. Apr 07, 13:46    Post subject: Reply with quote Print

nevertheless it sounds good to me, another workarround for complexbuilding,
you don't need the tubes, you dont need to extract them with the tubeles complex mod. So if this script is not too processor intensiv it should spare performance. Thx&solong


_________________
learn from the past, live the moment, dream of the future
***modified*** eh klar
Back to top
View user's profile Send private message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
PostPosted: Sat, 28. Apr 07, 11:53    Post subject: Reply with quote Print

Whoever put 'not good' on the poll...why? Tell me what you thought so I can look at it.


_________________
Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..
Back to top
View user's profile Send private message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
PostPosted: Sat, 5. May 07, 08:23    Post subject: Reply with quote Print

UPDATED TO V2.1.1
See first post for link.

Changes:

2.1.1
Working release.

2.1BETA
Further code refinements, only released so I could get help fixing a few little bugs

2.0BETA
Major update, command now only available on trade docks/PHQ
Arguement added for % ware to be retained
Pricing now 5% * dist per unit transferred, only charged for goods going from producing station to trade dock
Small code refinements
**Didn't work as planned, note the BETA**

1.2.1
Small update, now the command is visible when running from the station command menu.


_________________
Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..
Back to top
View user's profile Send private message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
modified
PostPosted: Sun, 6. May 07, 16:41    Post subject: Reply with quote Print

UPDATED TO V2.1.2
See first post for link.

Changes:

Added a list of stations in range to the incomming message


On this point:
Quote:
*Note 2* Although I am working on a way to be able to change the values without being charged, I have so far been unable to to so Sad this means you will have to restart the script (and therefore pay another 100,000cr) but I'll keep looking into it for the next release Smile
the script files are all there, 'HI.SFTQuestion' is the response script for the question, if someone could have a look at it and see if you can find any problems with it.. 'HI.StationFreightTransporter' has the actual question, just do the following:
Line 64: uncomment
Line 81: uncomment
Line 82: comment

Then re-init scripts and run the command, you will get a question instead of a message, press no and the script will end with no charge, press yes however, no charge still (although it should) and after the random wait, you will be bombarded by incomming questions telling you to the effect 'Unknown Station in sector null has insufficient funds...'
That message is from 'HI.TransportToTradeStation', but if you look at it, it is set up so it should only be sent once. If anyone can see the problem, let me know please Smile


_________________
Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..


Last edited by Heretic666 on Mon, 7. May 07, 00:18; edited 2 times in total
Back to top
View user's profile Send private message
Heretic666





Joined: 20 Feb 2004
Posts: 461 on topic
Location: UK
Thank you for registering your game
PostPosted: Sun, 6. May 07, 23:45    Post subject: Reply with quote Print

Anyone that downloaded the updated script before now will have to d/l it again, I missed a file out...sorry Embarassed


_________________
Station Freight Transporter
B-O'F: Enjoy whatever you are doing, if you decide to try real scripting one day..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic Reply to topic
 
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 Thu, 9. Sep 10, 13:54

All times are GMT + 2 Hours


Board Security

Copyright © EGOSOFT 1989-2009
Powered by phpBB © 2001, 2005 phpBB Group
Message Board Statistics Template created by Avatar & BurnIt!
Debug: page generation = 0.24608 seconds, sql queries = 74