[X3LU] Quick Wings 1.10

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

[X3LU] Quick Wings 1.10

Post by kaistern » Sat, 8. Nov 14, 13:13

:arrow:Background:

With the improved wing functions in LU I have found myself relying more and more on wings. However the 10-50 button clicks (count them, include the arrow keys) to give orders to a wing in the middle of a fight is not efficiant. I wanted better. Then I saw Cycrow's Wing Hotkeys. This gave me the idea. It was close to what I wanted but not quite there, and I was not sure if it would be compatible with LU. Because of this I wrote my own version for LU.

:arrow:Installation:

Download Drop the contents of the scripts folder into your addon/scripts of your game files.

:arrow:What it does:

Quick Wings adds 12 hotkeys. Eight are selection hotkeys for each wing and four are command hotkeys. When you press one of the selection hotkeys it selects the wing without changing your target, then you press one of the command hotkeys

1: Action: If you have an enemy targeted the wing will attack, if you have a non-enemy targeted the wing will protect it. If you do not have a target the wing will protect you.

2: Shield attack: Same as the Action hotkey except it preforms a shield attack against a target enemy.

3: Protect me: nuff' said.

4: Dock: If a valid dock is selected the wing will dock, if not it will return to it's homebase.

And that's all there is to it.

:arrow:Uninstall:

In case you need to uninstall Quick Wings a uninstall script is included. To uninstall run the uninstall script (qw.uninstall.xml) and then exit the game and uninstall the 14 scripts with "qw" in their names. Do not load or start a game after running the uninstall script or you will have to run it again.


ENJOY!!! And please give a shout out if you download, just so I know people are enjoying my work. Suggestions, comments, and hints appreciated!


Thank you Joubarbe and Cycrow for being my mentors in this, Litcube for.... well everything, just everything; Cycrow for his amazing guide that really helped me understand scripting, and the writers of the MSCI handbook which is invaluable.
Last edited by kaistern on Thu, 27. Nov 14, 23:51, edited 20 times in total.

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Sat, 8. Nov 14, 13:14

Future Goals and Ideas:
3: I want an error message written to your player log in case of error(I don't think this will be a problem except for the dock hotkey which must either have a vaild target or a homebase).
4 :Make the scrips prettier for Joubarbe and Cycrow. (For the life of me I can get this to work :-( )
5: Add refuel command for Joubarbe. This might be hard.
6: Add ability to add/remove target from wing. ->Hector0x
7: Passive decoy mode. Not sure if this is even possible but I'll look into it. ->Hector0x
8: I want wings to respect MCLL missile ROE. This might be hard.

11/27/2014: Version 1.1
-----Betty now talks
-----Uninstall script now included (hope you never need it)
11/13/2014: Released version 1.0
Last edited by kaistern on Fri, 28. Nov 14, 13:48, edited 4 times in total.
Image
Running LU 1.4.7 + XM-O 1.0 + Quick Wings 1.0
Rise of Phanon DiD LUV
Wrath of the Hive DiD XM-O
Try my script: Quick Wings for better wing control in LU!

User avatar
Joubarbe
Posts: 4050
Joined: Tue, 31. Oct 06, 13:11
xr

Post by Joubarbe » Sat, 8. Nov 14, 14:14

In short, you need to call one of the !wing.cmd....xml scripts on a wing's ship.

Code: Select all

START [THIS] -> call script '!wing.cmd.attack.std' : .....
Good luck :)

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Sat, 8. Nov 14, 14:31

Joubarbe wrote:In short, you need to call one of the !wing.cmd....xml scripts on a wing's ship.

Code: Select all

START [THIS] -> call script '!wing.cmd.attack.std' : .....
Good luck :)
Thanks! I understand how to order the attack, what I do not understand is how to make one button figure out which of 6 wings to give the order to based on a previous button click....

Senario: you have 3 wings, 2 enemy m7s, a swarm of enemy fighters, and a friendly TS to prtect
Target enemy m7: press button 1 to select blue wing, then button 11 to order the attack.
Change target to the TS: button 2 to select select red wing, button 12 to order red wing to escort:protect the TS.
Change target to the other m7, button 3 to select green wing, button 11 to launch attack.

m7s are now dead

Target TS: button 4 to select all wings, button 12 to order all wings to escort:protect the TS


I can't actually target the wing or I lose most of the functionality I want.

but I don't know how to make the wing selection buttons tell the command buttons which wing to give the order.
Image
Running LU 1.4.7 + XM-O 1.0 + Quick Wings 1.0
Rise of Phanon DiD LUV
Wrath of the Hive DiD XM-O
Try my script: Quick Wings for better wing control in LU!

User avatar
Joubarbe
Posts: 4050
Joined: Tue, 31. Oct 06, 13:11
xr

Post by Joubarbe » Sat, 8. Nov 14, 14:48

You cannot give an order to a wing directly with the command I specified on your other thread. A wing is not a ship and only ships can take orders.

If I'm not mistaken, you have to use this :

Code: Select all

get flight wing ship array: wing=$Wing
This should return an array with all the ship of the predefined wing. I guess you can do something like that :

Code: Select all

$Wing = get predefined wing: wing=[Wing.Blue]
$Wing.Ships = get flight wing ship array: wing=$Wing
$Ship = $Wing.Ships[0]
Then give the wing order to this single ship. Some tests are probably needed because I don't use these commands often.

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Sat, 8. Nov 14, 15:04

ROFL joubarbe you and me are having a communication break down :D

I want ONE button the gives orders to different wings depending on your previous button click. What I need to know is how to tell the script which wing to select. What you have given me (i think if i understand correctly) will allow me to give the order to ONLY blue wing however I want that same button to be able to select one of several wings(blue, red, green, rainbow, or all of them) depending on another hotkey you pushed and issue the command. The lines you gave me (I think) will be useful in the wing selection hotkeys, but they are only half of that hotkey, I also need a way for the 6 or so wing selection hotkeys to tell the ONE action hotkey which wing to give orders to.

6 hotkeys to choose which wing does the action (wing selection hotkeys)

1 hotkey to execute the action (command hotkey)

but I don't know how to make the 6 selection hotkeys tell the 1 command hotkey which wing to select.


If you understand all of this and the communication error is on my end then I don't understand how that will communicate between the 2 kinds of hotkey
Image
Running LU 1.4.7 + XM-O 1.0 + Quick Wings 1.0
Rise of Phanon DiD LUV
Wrath of the Hive DiD XM-O
Try my script: Quick Wings for better wing control in LU!

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Sat, 8. Nov 14, 15:20

I may have figure it out.... more later :D
Image
Running LU 1.4.7 + XM-O 1.0 + Quick Wings 1.0
Rise of Phanon DiD LUV
Wrath of the Hive DiD XM-O
Try my script: Quick Wings for better wing control in LU!

User avatar
Joubarbe
Posts: 4050
Joined: Tue, 31. Oct 06, 13:11
xr

Post by Joubarbe » Sat, 8. Nov 14, 15:22

kaistern wrote: 6 hotkeys to choose which wing does the action (wing selection hotkeys)

1 hotkey to execute the action (command hotkey)
Then how do you set the action to execute ? How will they know what to do between Attack, Dock or Protect ?

Anyway, my code is still relevant, I think you didn't get that [Wing.Blue] can be a variable.

Code: Select all

$PredefinedWing = get global variable 'ModPrefix_SelectedWing'
$Wing = get predefined wing: wing=$PredefinedWing
The PredefinedWing could be changed when you press one of the 6 hotkeys.

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Sat, 8. Nov 14, 16:14

I understood that :D

Ok I am currently trying to get 2 scripts to communicate. What I want is the first one to write a to a text file, then the second one to read the text file, and if a then write not fail, else write fail

first one is easy *I think*

Code: Select all

write to log file #1 append=1 value='a'
the second on is

Code: Select all

001 $b = read text: page=1 id=1
002 skip if $a == 'a' 
003 write to player logbook 'fail'
004
005 write to player logbook 'not fail'
and I get fail

I think the problem is in the "==" I used <RetVar/IF><Expression> from the general commands but I don't know if that is right and i could find a better on or the option "->"

(working on getting x-studio up)
Image
Running LU 1.4.7 + XM-O 1.0 + Quick Wings 1.0
Rise of Phanon DiD LUV
Wrath of the Hive DiD XM-O
Try my script: Quick Wings for better wing control in LU!

User avatar
Joubarbe
Posts: 4050
Joined: Tue, 31. Oct 06, 13:11
xr

Post by Joubarbe » Sat, 8. Nov 14, 18:12

Why the hell are you trying to do that ? :)

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Sun, 9. Nov 14, 01:03

still trying to make the 2 scripts talk to each other. The current idea is if the wing select script writes something to a text file and then the command key can read it and know what to do based on that.

ie bluewing select script writes 'blue' to a text file. action key reads 'blue' from the text file and then gives the action to blue wing. press redwing select script and it writes 'red' to a textfile then action key reads red and gives the action command to red wing

the only concern I have is that when it wrtes to the text document it MUST overwrite the previous one..... and i need to find which script to use to read and write... the ones I have now are not working
Image
Running LU 1.4.7 + XM-O 1.0 + Quick Wings 1.0
Rise of Phanon DiD LUV
Wrath of the Hive DiD XM-O
Try my script: Quick Wings for better wing control in LU!

User avatar
Joubarbe
Posts: 4050
Joined: Tue, 31. Oct 06, 13:11
xr

Post by Joubarbe » Sun, 9. Nov 14, 01:13

And that's why they created.... Arguments ! :)

... and return values.

A script that you call can return a value. You can pass informations to other scripts using arguments and receive ones with return values.

Take one of my library call :

Code: Select all

$Objective.Sector = [THIS]-> call script 'lib.joubarbe.getrandomsector' : startsector=$Mission.Sector minjumps=1 maxjumps=2 owner=$Mission.Employer.Race onlyknownsectors=[FALSE] securitylevel=0
Open the script : at the end you'll see :

Code: Select all

return $Sector
That's the return value. $Objective.Sector stores this to use it in its own script.

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Sun, 9. Nov 14, 03:51

I have the next two days off so I'll have to open some of your stuff up and see if I can figure out auguments lol

I tried to open up Cycrow's wing commands but didn't work, it tried it in the game, in IE, chrome, microsoft XML viewer, and then x-studio but they all gave me an error message. I ran out of time before I could explore further but I am hoping that it is something simple like I forgot to unzip it :P maybe a bad download though

I am thinking that tomorrow I am going to work on making a teaser mod to showcase the functionality of the mod. What I am thinking should be easy, but it will only work with one wing. But it will be cool to release something that shows what I am trying to do.
Image
Running LU 1.4.7 + XM-O 1.0 + Quick Wings 1.0
Rise of Phanon DiD LUV
Wrath of the Hive DiD XM-O
Try my script: Quick Wings for better wing control in LU!

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Sun, 9. Nov 14, 07:17

I reread through everything and
Joubarbe wrote:Anyway, my code is still relevant, I think you didn't get that [Wing.Blue] can be a variable.

Code: Select all

$PredefinedWing = get global variable 'ModPrefix_SelectedWing'
$Wing = get predefined wing: wing=$PredefinedWing
The PredefinedWing could be changed when you press one of the 6 hotkeys.
I didn't understand what a global variable was on the first pass through but I have a better understanding now and i feel like I just got hit by a clue by four...

this solves everything.....

THANKS JOUBARBE!!!!!!!!!
Image
Running LU 1.4.7 + XM-O 1.0 + Quick Wings 1.0
Rise of Phanon DiD LUV
Wrath of the Hive DiD XM-O
Try my script: Quick Wings for better wing control in LU!

kaistern
Posts: 441
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Sun, 9. Nov 14, 08:00

ok here is what I want to test tommorrow and if it works use it as a teaser while i finish up the rest. See if it looks correct.

This should only add one hotkey that allows you to give orders to blue wing without use of windows. It's effect changes based on your target, if it's an enemy it will attack, if it is not an enemy it will protect it, if it is anything except a ship or station the wing will instead protect your ship.

Note: I dont have access to anything but the forums right now so I'll have to modify the script being called part of the action key so that it targets the correct scripts.

First to register the hotkey...

Code: Select all

setup.qw.register
001 $key = get global variable: name='qw.baction'
002 if not $key ...
003    $key= register hotkey 'Blue wing action command' to call script qw.baction
004    set global vairiable: name='qw.baction' value=$key
005 end
and then for the command itself

Code: Select all

qw.baction
001 $target = get player tracking aim
002 $Wing = get predefined wing: wing=[Wing.Blue] 
003 $Wing.Ships = get flight wing ship array: wing=$Wing 
004 $Ship = $Wing.Ships[0]
005 If $target = ship or station and enemy 
006   $ship -> call script 'attack my target'
007
008 Else if $target = ship or station and not enemy
009   $ship -> call script 'protect my target'
010
011 Else 
012   $ship -> call script 'protect me'
013 end
and to uninstall

Code: Select all

qw.unregister
001 $key = get global variable: name= 'qw.baction'
002 if $key ...
003  unregister hotkey $key
004 set global variable: name='qw.baction value=null
005 end
if this all looks good then when I get home and after i get some rest i'll test it out, clean it up and upload it for your enjoyment :D

Hopefully if this all works i'll finish up the rest of what I want and release the entire mod later this week

(Big thanks to Joubarbe for keeping me in line ;), and to cycrow for his guide, and whoever wrote the MSCI handbook)
Image
Running LU 1.4.7 + XM-O 1.0 + Quick Wings 1.0
Rise of Phanon DiD LUV
Wrath of the Hive DiD XM-O
Try my script: Quick Wings for better wing control in LU!

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”