EnglishGermanFrenchRussianPolishItalianSpanish
Log inRegister
 
Checking generator stats
Post new topic Reply to topic Goto page 1, 2  Next
View previous topic :: View next topic
Author Message
EmperorJon



MEDALMEDAL

Joined: 29 Dec 2008
Posts: 6665 on topic
Location: Leicester
Thank you for registering your game
PostPosted: Sat, 20. Mar 10, 19:52    Post subject: Checking generator stats Reply with quote Print

Any way to check the laser and shield generator stats of a ship?

Or, failing that, to extract them from a file somewhere?

Eg, reading them from a tfile that exists and using the value?

Basically I need ot be able to get the Laser and shield generation value of every ship in the game as a variable (not at the same time Wink )

This is in order to link generators, as suggested here: http://forum.egosoft.com/viewtopic.php?t=273550


_________________
_______________________________
The Trade Plugin - Finally out of Beta.
STFUnit - Military Plugin
Find All Crates/Ships!
I Feel Like Killing GoD.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Roger L.S. Griffiths



MEDALMEDAL

Joined: 12 Mar 2004
Posts: 5752 on topic
Location: United Kingdom
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 00:38    Post subject: Reply with quote Print

Here is my first stab at the main script
Code:
001   if [DOCKEDAT] == null
002   |[THIS] -> set local variable: name='pwrlink.active' value=[FALSE]
003   else
004   |$carrier1 = [DOCKEDAT] -> get current shield strength
005   |while [THIS] -> get local variable: name='pwrlink.active'
006 @ ||= wait 1000 ms
007   ||if [DOCKEDAT] == null
008   |||[THIS] -> set local variable: name='pwrlink.active' value=[FALSE]
009   ||else
010   |||$carrier2 = [DOCKEDAT] -> get current shield strength
011   |||$shield = [THIS] -> get shield percent
012   |||if $shield >= 50
013   ||||$dmg = ( $carrier1 - $carrier2 ) / 100
014   ||||$dmg =  get maximum, $dmg, 0, null, null, null
015   ||||$ship = [THIS] -> get current shield strength
016   ||||$ship = $ship - $dmg
017   ||||$ship =  get maximum, $ship, 0, null, null, null
018   ||||[THIS] -> set current shield strength to $ship
019   ||||$shield = [THIS] -> get shield percent
020   ||||if $shield >= 50
021   |||||$regen = [THIS] -> get power generator
022   |||||$laser = [DOCKEDAT] -> get current laser strength
023   |||||$max = [DOCKEDAT] -> get maximum laser strength
024   |||||$laser = $laser + ( $regen / 2 )
025   |||||$laser =  get maximum, $laser, $max, null, null, null
026   |||||[THIS] -> set laser energy to $laser
027   ||||end
028   |||end
029   |||$carrier1 = $carrier2
030   ||end
031   |end
032   end
033   return null



_________________
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"How do you eat an elephant? One bite at a time." - Unknown
Back to top
View user's profile Send private message MSN Messenger
EmperorJon



MEDALMEDAL

Joined: 29 Dec 2008
Posts: 6665 on topic
Location: Leicester
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 09:46    Post subject: Reply with quote Print

I'm confused now! Laughing

So you have Get Power Generator?

Is that for laser or shield?


_________________
_______________________________
The Trade Plugin - Finally out of Beta.
STFUnit - Military Plugin
Find All Crates/Ships!
I Feel Like Killing GoD.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
LV
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 06 Nov 2002
Posts: 6299 on topic
Location: The Dark Side
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 09:56    Post subject: Reply with quote Print

p gen is recharge of shields time, poss laser also

the value will probably be held in tships, it is possible (but long and cpu intensive) to scan through allships in the game using maincodes and subtypes

Code:

006   $main = 8
007   $subs =  get number of subtypes of maintype $main
009   
010   
011   while $subs > 0
012   |dec $subs =
013   |$ware =  get ware from maintype $main and subtype $subs
018   end


the 2 commands are in the trade menu and this one is retuning lasers, check the tutorial stickie for a list of the other maintypes


there is probably also an easier way but i've not long been awake Wink


_________________
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

LV has left the building
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
EmperorJon



MEDALMEDAL

Joined: 29 Dec 2008
Posts: 6665 on topic
Location: Leicester
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 10:39    Post subject: Reply with quote Print

Couldn't you just get the main and sub type of the ship you wanted and then run it?

Either

1. I'm being stupid

2. LV really is not at all awake


_________________
_______________________________
The Trade Plugin - Finally out of Beta.
STFUnit - Military Plugin
Find All Crates/Ships!
I Feel Like Killing GoD.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Roger L.S. Griffiths



MEDALMEDAL

Joined: 12 Mar 2004
Posts: 5752 on topic
Location: United Kingdom
Thank you for registering your game
modified
PostPosted: Sun, 21. Mar 10, 10:47    Post subject: Reply with quote Print

EmperorJon wrote:
I'm confused now! Laughing

So you have Get Power Generator?

Is that for laser or shield?

In the Script Editor, Get Power Generator is under weapon information thus I presume it is for the "Weapon Regen" if not then it's location is notionally a bug.

EDIT: Just done a debug test and it is the SHIELD power generator, so it's location is a bug.


_________________
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"How do you eat an elephant? One bite at a time." - Unknown


Last edited by Roger L.S. Griffiths on Sun, 21. Mar 10, 13:08; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
EmperorJon



MEDALMEDAL

Joined: 29 Dec 2008
Posts: 6665 on topic
Location: Leicester
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 10:51    Post subject: Reply with quote Print

That would make sense... yes...

Why is why you've done all the crazy calculations for the Shields I presume...


I didn't read through it myslef. I have trouble understanding TC scripting unless I wrote it. Embarassed


_________________
_______________________________
The Trade Plugin - Finally out of Beta.
STFUnit - Military Plugin
Find All Crates/Ships!
I Feel Like Killing GoD.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Roger L.S. Griffiths



MEDALMEDAL

Joined: 12 Mar 2004
Posts: 5752 on topic
Location: United Kingdom
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 13:51    Post subject: Reply with quote Print

Ok, I have some success in coding the script... it comes in 2 parts...

Carrier Power Link start script
Code:
001   $docked = [THIS] -> get ship array from sector/ship/station
002   $idx =  size of array $docked
003   while $idx
004   |dec $idx =
005   |$ship = $docked[$idx]
006 @ |START $ship -> call script 'test.rg.pwrlink' :
007   end
008   return null

Docked Ship Power Link script
Code:
001   infinite loop detection enabled=[FALSE]
002   $regen = [THIS] -> get power generator
003   $msg = 'Power Generator for ' + [THIS] + ' is ' + $regen
004   write to player logbook $msg
005   loop:
006   $shield = [THIS] -> get shield percent
007   while $shield < 100
008 @ |= wait 1000 ms
009   |$ship = [THIS] -> get current shield strength
010   |$max = [THIS] -> get maximum shield strength
011   |$ship = $ship + ( $regen / 2 )
012   |$ship =  get maximum, $ship, $max, null, null, null
013   |[THIS] -> set current shield strength to $ship
014   |$shield = [THIS] -> get shield percent
015   end
016   $msg = 'Power Link engaging for ' + [THIS]
017   display subtitle text: text=$msg duration=3000 ms
018   $carrier1 = [DOCKEDAT] -> get current shield strength
019   while $shield >= 50
020 @ |= wait 1000 ms
021   |$carrier2 = [DOCKEDAT] -> get current shield strength
022   * Calculate excess shield damage to carrier
023   |$dmg = ( $carrier1 - $carrier2 ) / 100
024   |$dmg =  get maximum, $dmg, 0, null, null, null
025   * Apply 1% of excess shield damage to docked ship
026   |$ship = [THIS] -> get current shield strength
027   |$ship = $ship - $dmg
028   |$ship =  get maximum, $ship, 0, null, null, null
029   |[THIS] -> set current shield strength to $ship
030   * Check that docked ship has 50% or more remaining
031   |$shield = [THIS] -> get shield percent
032   |if $shield >= 50
033   * Pass on power from docked ship to carrier weapons
034   ||$laser = [DOCKEDAT] -> get current laser strength
035   ||$max = [DOCKEDAT] -> get maximum laser strength
036   ||$laser = $laser + ( $regen / 2 )
037   ||$laser =  get maximum, $laser, $max, null, null, null
038   ||[DOCKEDAT] -> set laser energy to $laser
039   |end
040   |$carrier1 = $carrier2
041   end
042   $msg = 'Power Link disengaged for ' + [THIS]
043   display subtitle text: text=$msg duration=3000 ms
044   goto label loop
045   return null


With just a Pirate Kestral docked at my Hyperion I can fire ISR continuously so the efficiency co-efficient (currently 50% for weapon power/docked shield regen) probably needs to be severely reduced if we are to continue using shield power for the script.

As a proof of concept the above works but it needs further refinement.

The Docked Ship Power Link script does not allow the Power Link to start unless the docked ship has 100% shields and will use the redirected power to charge the shields if necessary.

Once the Power Link has engaged the docked ship will redirect it's power to the Carrier's weapons and will sustain 1% of the excess damage that the carrier takes to it's shields. When the docked ship looses 50% or more of it's shields it will disengage and recharge the shields back to 100% before re-engaging.


_________________
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"How do you eat an elephant? One bite at a time." - Unknown
Back to top
View user's profile Send private message MSN Messenger
EmperorJon



MEDALMEDAL

Joined: 29 Dec 2008
Posts: 6665 on topic
Location: Leicester
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 14:05    Post subject: Reply with quote Print

Nice!

I was going to make this, but you're doing it for me.

Wink

As long as I can use it in my Military plugin, that's fine. (Might be fine-tuned and changed though)

(I'm also going to include weapons, sheilds and speed transferrals. So, lose all your weapon energy but boost out of combat, but down your speed but recharge shields quickly etc.)


_________________
_______________________________
The Trade Plugin - Finally out of Beta.
STFUnit - Military Plugin
Find All Crates/Ships!
I Feel Like Killing GoD.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Roger L.S. Griffiths



MEDALMEDAL

Joined: 12 Mar 2004
Posts: 5752 on topic
Location: United Kingdom
Thank you for registering your game
modified
PostPosted: Sun, 21. Mar 10, 14:39    Post subject: Reply with quote Print

EmperorJon wrote:
Nice!

I was going to make this, but you're doing it for me.

Wink

As long as I can use it in my Military plugin, that's fine. (Might be fine-tuned and changed though)

Well feel free... just include me as a tiny footnote in the credits and we are even Wink

EDIT 01-Apr-2010
And no this is not an April Fool Razz

Although, I have authorised EmperorJon to include an implementation of the concept discussed here I would like to point towards my own implementation of it: Carrier Power Link System (CPLS).


_________________
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"How do you eat an elephant? One bite at a time." - Unknown


Last edited by Roger L.S. Griffiths on Thu, 1. Apr 10, 10:48; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
LV
Moderator (Script&Mod)
Moderator (Script&Mod)



Joined: 06 Nov 2002
Posts: 6299 on topic
Location: The Dark Side
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 15:23    Post subject: Reply with quote Print

One problem i saw while skimming.

you should call this script (which appears ok in code) as a task.

otherwise it may sit dead in space while it's held in a loop.


get next available task then start task etc etc

as long as you don't start telling the ship to do things via this task script in will run at the same time as any ship command e.g. fight.attack.obj


_________________
LV's TC Scripts
Readme's For All My Scripts


I felt a great disturbance in the forum, Like millions of voices cried out in terror, then were silenced

LV has left the building
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Roger L.S. Griffiths



MEDALMEDAL

Joined: 12 Mar 2004
Posts: 5752 on topic
Location: United Kingdom
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 15:52    Post subject: Reply with quote Print

LV wrote:
One problem i saw while skimming.

you should call this script (which appears ok in code) as a task.

otherwise it may sit dead in space while it's held in a loop.


get next available task then start task etc etc

as long as you don't start telling the ship to do things via this task script in will run at the same time as any ship command e.g. fight.attack.obj

The intent in my script was that it would be the only command running on the fighter while it is docked and the fighter would cease to supply power if it undocks or is given another command and my initial testing proves it works as I intended.


_________________
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"How do you eat an elephant? One bite at a time." - Unknown
Back to top
View user's profile Send private message MSN Messenger
EmperorJon



MEDALMEDAL

Joined: 29 Dec 2008
Posts: 6665 on topic
Location: Leicester
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 16:05    Post subject: Reply with quote Print

Yes, but that might not work as intended, because fighter set to protect carrier etc. will redock after the fight and not lend recharge. Ships set to follow the carrier won't, ships accidentally set to idle or standby won't...

I'm working on somethin new now anyway. Capital ship explosions upon death. Razz


_________________
_______________________________
The Trade Plugin - Finally out of Beta.
STFUnit - Military Plugin
Find All Crates/Ships!
I Feel Like Killing GoD.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Roger L.S. Griffiths



MEDALMEDAL

Joined: 12 Mar 2004
Posts: 5752 on topic
Location: United Kingdom
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 16:15    Post subject: Reply with quote Print

EmperorJon wrote:
Yes, but that might not work as intended, because fighter set to protect carrier etc. will redock after the fight and not lend recharge. Ships set to follow the carrier won't, ships accidentally set to idle or standby won't...
Perhaps, personally I would consider it a balancing feature, I was considering the recharge a role for the fighter rather than a carte-blanche bonus to the carrier while it is docked. If you retask the fighter to external detail then it returns, you would naturally have to reconnect all the cables for the power generator. I had been toying with something along the lines of it running in the background but I had concerns about the load on the processor.

But this is all down to design decision/intent at the end of the day and will come out in the wash. Wink

EmperorJon wrote:
I'm working on somethin new now anyway. Capital ship explosions upon death. Razz

Kewl, but I already thought there were explosions on Capital ship death... or are you talking about something a little different?


_________________
Roger (aka [SRK] Mr^Rabbit)

"Understanding is a three edged sword... your side, their side... and the Truth!" - J.J. Sheriden, Babylon 5 S4E6 T28:55

"May god stand between you and harm in all the dark places you must walk." - Ancient Egyption Proverb

"How do you eat an elephant? One bite at a time." - Unknown
Back to top
View user's profile Send private message MSN Messenger
EmperorJon



MEDALMEDAL

Joined: 29 Dec 2008
Posts: 6665 on topic
Location: Leicester
Thank you for registering your game
PostPosted: Sun, 21. Mar 10, 16:37    Post subject: Reply with quote Print

Quote:
reconnect all the cables for the power generator


Point taken. Laughing

Quote:
but I already thought there were explosions on Capital ship death... or are you talking about something a little different?


I mean, actual, explosions. That like... kill you. Very Happy


_________________
_______________________________
The Trade Plugin - Finally out of Beta.
STFUnit - Military Plugin
Find All Crates/Ships!
I Feel Like Killing GoD.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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 Fri, 24. May 13, 14:54

All times are GMT + 2 Hours


Board Security

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