[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

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Wed, 12. Nov 14, 10:12

And FYI kaistern, in this case, [THIS] = null = $null.

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

Post by kaistern » Thu, 13. Nov 14, 04:46

Thanks guys I took your info and.... it worked sort of... I am once again running into issues with the scripts communication, and for some reason when I DO manage to get the order through to the wing it acts wierd. But lets start from the beginning, I changed the action code to

Code: Select all

$target = get player tracking aim
$flag = get global variable: name='qw_flag'
if not $flag-> exists
write to player logbook 'Error: No wing selected'
play sample 920
end
skip if $flag-> exists
return null
if $target-> is [PLAYERSHIP] a enemy
START [THIS]-> call script '!wing.cmd.attack.std' : WING=$flag target=$target
else if $target-> is [PLAYERSHIP] a friend
START $ship-> call script '!wing.cmd.protect.std' : WING=$target target=[FALSE]
else
START $ship-> call script '!wing.cmd.protect.std' : WING=[PLAYERSHIP] target=[FALSE]
end
return null
(I later added the message to logbook and the play sample to let me know when the scripts are not talking properly, but more on that later)

and nothing happened. So I decided to try changing the WING=$flag to WING=BLUE WING to see if it would work... and it DID!!! or sort of the wing jumped in and started on the enemy, but I obviously was not done with the code so I used the normal way to order them back to their homebase which is when it got weird. Instead of jumping back home they just sat there. When I checked their info panel I noticed that their action was jumping back and forth between "move to" (from the command for the wing to jump home I assume) and "attack in formation" (from the attack command I made I assume. Any ideas why this happened? I could not for the life of me get them to stop so I had to reload the game.

After messing with the above for an hour or so and not getting anywhere I decided to switch gears for awhile, and work on the 2 scripts communicating. That's when I added the message "Error: No wing selected" and the audio file so that I knew when they were not working together. I wasn't sure what was going on so I wrote a short script to check the state of the flag.

Code: Select all

$flag = get global variable: name='qw_flag'
write to player logbook $flag
return null
which returned "3" which was really weird to me since it should read "BLUE WING" (though I used the select flight wing option to put the works blue wing in the flag code) but what was also weird is that the flag did exist so it should not have been saying that it wasn't (everytime I was running the action script I was hearing the explosions that should only exist if the flag doesn't)

ANyhow I'm going back to work on it.
[ external 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: 443
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Thu, 13. Nov 14, 04:53

Actually I may have fixed these stand by for testing...
[ external 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: 443
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Thu, 13. Nov 14, 06:07

or not... still having both issues, Blue wing as a global variable is not seeming to come through as blue wing the wing.

Code: Select all

$target = get player tracking aim
$flag = get global variable: name='qw_flag'
$Wing = get predefined wing: wing=$flag
write to player logbook $target
write to player logbook $flag
write to player logbook $Wing
if $target-> is [PLAYERSHIP] a enemy
START [THIS]-> call script '!wing.cmd.attack.std' : WING=$Wing target=$target
end
return null
This writes 2 player logs the first is blue wing and the second is null.

As well when I change wing=$wing to wing=blue wing blue wing does get the order and follow it but refuses to follow any subsequent orders and instead just sits there.

anyhow I am going to try another idea I had (going back to the flag just being a color and then the action script changing it to a wing, ik ik it take more time to program, but at this rate.... lol)

---------------------------------------------------------




ADDED: I changed the flag script to

Code: Select all

set global variable: name='qw_flag' value='Blue'
return null
and the action script to

Code: Select all

$target = get player tracking aim
$flag = get global variable: name='qw_flag'
if $flag == 'Blue'
$wing = get predefined wing: wing=[Wing.Blue]
end
write to player logbook $target
write to player logbook $flag
write to player logbook $wing
if $target-> is [PLAYERSHIP] a enemy
START [THIS]-> call script '!wing.cmd.attack.std' : WING=$wing target=$target
end
return null
and it worked! Except for the whole "this is the last command ill ever accept" thing lol. maybe i need to set the wing state....

----------------------------------


ADDED2: What is the point of .pl.xml scripts? All they seem to do is call a exact same named .xml script.

---------------------------------


ADDED3: I changed the script to

Code: Select all

$target = get player tracking aim
$flag = get global variable: name='qw_flag'
if $flag == 'Blue'
$wing = get predefined wing: wing=[Wing.Blue]
end
write to player logbook $target
write to player logbook $flag
write to player logbook $wing
if $target-> is [PLAYERSHIP] a enemy
= [THIS]-> call script '!wing.cmd.attack.std' : WING=$wing target=$target
end
return null
but no change in action it still refuses to take any orders after the attack script is called.I'm not sure what I am doing wrong, I think my script now simulates what happens when you go into the command consul and issue the attack command.... grrrrr....... Did I make a loop some how? Is my script not ending properly?
[ external 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: 443
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Thu, 13. Nov 14, 08:21

Ok I figured out the why they keep going back to the same order.... The order never falls off the global list!!!! So now I need to figure out how to force it off the global list, maybe a break? (Added: yeah that didn't work but at least I know what the problem is.... back to the MSCI handbook to see if i can figure this out before you guys get online, if I do i'll post if not I hope ya'll might have an idea or two ;) )

current code

Code: Select all

* ************************************************
* SCRIPT NAME: Quick Wings action command.xml
* DESCRIPTION: Gives the selected wing the attack/protect target/protect me command
* 
* AUTHOR:Kaistern           DATE: 9 November 2014
* ************************************************
$target = get player tracking aim

* Uses the quick wing flag to determine which wing to give orders to
$flag = get global variable: name='qw_flag'
if $flag == 'Blue'
$wing = get predefined wing: wing=[Wing.Blue]
else if $flag == 'Red'
$wing = get predefined wing: wing=[Wing.Red]
else if $flag == 'Gold'
$wing = get predefined wing: wing=[Wing.Gold]
else if $flag == 'Green'
$wing = get predefined wing: wing=[Wing.Green]
else if $flag == 'Orange'
$wing = get predefined wing: wing=[Wing.Orange]
else if $flag == 'Purple'
$wing = get predefined wing: wing=[Wing.Purple]
else if $flag == 'Silver'
$wing = get predefined wing: wing=[Wing.Silver]
else if $flag == 'White'
$wing = get predefined wing: wing=[Wing.White]
end

* Error test to be removed before release
write to player logbook $target
write to player logbook $flag
write to player logbook $wing

* actual action commands
if $target-> is [PLAYERSHIP] a enemy
@ = [THIS]-> call script '!wing.cmd.attack.std' : WING=$wing target=$target
else if $target-> is [PLAYERSHIP] a friend
@ = [THIS]-> call script '!wing.cmd.protect.std' : WING=$wing target=$target
else
@ = [THIS]-> call script '!wing.cmd.protect.std' : WING=$wing target=[PLAYERSHIP]
end
return null
[ external 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!

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22224
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Thu, 13. Nov 14, 09:45

its been awhile since i did anything with wings, so cant remember the exact way to use them without looking it up.

it might be better to start the wing commands, rather than run the scripts directly on them.

wing commands are special, they dont work the same as ship commands. The scripts are run globally, but they shouldn't actually show up in the global scripts list, they should be hidden.
Sounds like running the scripts directly doesn't trigger this

Its possible that your global variable isn't work for the Blue wing only. You could store the actual wing object instead.

Code: Select all

$wing = get predefined wing: with=[Wing.Blue]
set global variable: name='qw_flag' value=$wing

the .pl scripts are player commands.
all command scripts have a number of arguments, when run by the player, there is an input for each argument.
so the .pl scripts use different arguments to change how the input works.
Or at least they used to, with AP and preload commands, these were changed abit, so some .pl scripts are no longer different

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Thu, 13. Nov 14, 10:43

kaistern wrote:

Code: Select all

$flag = get global variable: name='qw_flag'
write to player logbook $flag
return null
which returned "3" which was really weird to me since it should read "BLUE WING" (though I used the select flight wing option to put the works blue wing in the flag code) but what was also weird is that the flag did exist so it should not have been saying that it wasn't (everytime I was running the action script I was hearing the explosions that should only exist if the flag doesn't)
When you write something in brackets or braces, like [Argon], [Blue.Wing] or {Advanced Satellite} for instance, that always return an integer. They are strings in X-Studio for convenience, because otherwise it would be unreadable. Strings should always be avoided when you do not want to communicate to the player. Hence what I said earlier and what Cycrow said above. ($flag should be an integer, [Blue.Wing])

And that, again :
Cycrow wrote:it might be better to start the wing commands, rather than run the scripts directly on them.

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

Post by kaistern » Thu, 13. Nov 14, 10:53

thanks for the reply, unfortunately it raised more question then it answered :P
Cycrow wrote: it might be better to start the wing commands, rather than run the scripts directly on them.
how? lol
The scripts are run globally, but they shouldn't actually show up in the global scripts list, they should be hidden.
Sounds like running the scripts directly doesn't trigger this
To clarify in case I
caused some confusion, the wing commands were not what I saw on the global list, but my script. For some reason my script was not shutting down and instead it was continuing to run and (I think) reissue the order over and over again.
Its possible that your global variable isn't work for the Blue wing only. You could store the actual wing object instead.

Code: Select all

$wing = get predefined wing: with=[Wing.Blue]
set global variable: name='qw_flag' value=$wing
I tried it with a couple other wings as well, gold wing came back as 1, blue as 3... ect... idk why but the method I am using now seems to work(and i dont think that it should hurt performance? lol)
the .pl scripts are player commands.
all command scripts have a number of arguments, when run by the player, there is an input for each argument.
so the .pl scripts use different arguments to change how the input works.
Or at least they used to, with AP and preload commands, these were changed abit, so some .pl scripts are no longer different
ROFL I am just going to pretend any of that made since to me :D I dont think it is pertinent to my current scripts so.... anyway.... lol

---------------------------------------

I finished the script that creates the hotkeys, as well as all of the selection hotkeys. All of which run as expected. I THINK that the wing command it self is working correctly but MY script to call it is not dying like all good scripts should and instead it keeps issuing the order ever chance it gets. Unfortunately I THINK that this will apply to all of the command key that I write in the same format but..... meh...

Any ideas why my script isn't dying?
[ external 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: 443
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Thu, 13. Nov 14, 11:01

Joubarbe you ninja :D
Joubarbe wrote:
kaistern wrote:

Code: Select all

$flag = get global variable: name='qw_flag'
write to player logbook $flag
return null
which returned "3" which was really weird to me since it should read "BLUE WING" (though I used the select flight wing option to put the works blue wing in the flag code) but what was also weird is that the flag did exist so it should not have been saying that it wasn't (everytime I was running the action script I was hearing the explosions that should only exist if the flag doesn't)
When you write something in brackets or braces, like [Argon], [Blue.Wing] or {Advanced Satellite} for instance, that always return an integer. They are strings in X-Studio for convenience, because otherwise it would be unreadable. Strings should always be avoided when you do not want to communicate to the player. Hence what I said earlier and what Cycrow said above. ($flag should be an integer, [Blue.Wing])

And that, again :
Cycrow wrote:it might be better to start the wing commands, rather than run the scripts directly on them.
hmmm I think my head is not wrapping around integer... my algebra tells me that should be a number, so in short under the covers [blue.wing] is equal to 3, but to make it look good to me it reads [blue.wing] until I had the computer spit it out in a logbook where it returned to 3. Ok I'm with you now. Does it hurt anything to leave it the way it is now... errr... working? lol if it does hurt I'll change it and wrestle that lion again but if not i'll leave it alone :P

ADDED: malfunctioning script

Code: Select all

$target = get player tracking aim

* Uses the quick wing flag to determine which wing to give orders to
$flag = get global variable: name='qw_flag'
if $flag == 'Blue'
$wing = get predefined wing: wing=[Wing.Blue]
else if $flag == 'Red'
$wing = get predefined wing: wing=[Wing.Red]
else if $flag == 'Gold'
$wing = get predefined wing: wing=[Wing.Gold]
else if $flag == 'Green'
$wing = get predefined wing: wing=[Wing.Green]
else if $flag == 'Orange'
$wing = get predefined wing: wing=[Wing.Orange]
else if $flag == 'Purple'
$wing = get predefined wing: wing=[Wing.Purple]
else if $flag == 'Silver'
$wing = get predefined wing: wing=[Wing.Silver]
else if $flag == 'White'
$wing = get predefined wing: wing=[Wing.White]
end

* Error test to be removed before release
write to player logbook $target
write to player logbook $flag
write to player logbook $wing

* actual action commands
if $target-> is [PLAYERSHIP] a enemy
@= [THIS]-> call script '!wing.cmd.attack.std' : WING=$wing target=$target
else if $target-> is [PLAYERSHIP] a friend
@= [THIS]-> call script '!wing.cmd.protect.std' : WING=$wing target=$target
else
@= [THIS]-> call script '!wing.cmd.protect.std' : WING=$wing target=[PLAYERSHIP]
end
return null
ADDED2: after issuing the action command I went to the global scripts and manually kiled the action script and that reset the wing to it's normal state so it is defiantly the action script that is causing the problem. I need a way to force it to die? Could the interrupt spots be causing the problem? I tried to find a way to make it without them but was unable.
Last edited by kaistern on Thu, 13. Nov 14, 11:10, edited 1 time in total.
[ external 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: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Thu, 13. Nov 14, 11:08

It doesn't hurt, it's just ugly and useless :)

Code: Select all

$flag = get global variable: name = 'qw_flag'
$wing = get predefined wing: wing = $flag
---

When Cycrow said you need to start your scripts, it means what I said earlier :

Code: Select all

START THIS -> call script '!wing.cmd.attack.std' : WING=$wing target=$target
The problem is wings are special like he said, and I'd need to some tests to be sure how they work ; the problem is to overwrite the current command, and I'm not sure your script will do that.

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

Post by kaistern » Thu, 13. Nov 14, 11:21

Joubarbe wrote:It doesn't hurt, it's just ugly and useless :)

Code: Select all

$flag = get global variable: name = 'qw_flag'
$wing = get predefined wing: wing = $flag
I used this forever but couldn't get it to work (the flag was setting the global variable to vaule=[Blue.Wing] but $wing wouldn't set to it. I'll look at it again though to try and make things prettier for ya'll ;) )
When Cycrow said you need to start your scripts, it means what I said earlier :

Code: Select all

START THIS -> call script '!wing.cmd.attack.std' : WING=$wing target=$target
The problem is wings are special like he said, and I'd need to some tests to be sure how they work ; the problem is to overwrite the current command, and I'm not sure your script will do that.
this is the script I am using... err... i think. I use @ start this -> call script.... but i couldn't find a script call that didn't have the @ and when I tried to write it out in X-studio it auto added it

ADDED: any ideas about why the script isn't finishing properly?
[ external 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: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Thu, 13. Nov 14, 11:31

Forget the @, you don't need to worry about that.

Uhhh, just to be clear :

Code: Select all

!wing.cmd.attack.std
This is a script.

Code: Select all

call script
This is a command.

You have different way to call a script via your command. "= [THIS]" means you could have a return value given by the script you call (that could be "$MyReturnValue = [THIS]"). "START [THIS]" means you call the script on another "thread" and that won't return anything because your current script won't wait for it to finish.

And you call the script from "[THIS]" which is null, because it's a wing command.

You say you used START, no you didn't. You must write it manually.

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

Post by kaistern » Thu, 13. Nov 14, 11:33

I think when it calls the script instead of continuing and ending it is waiting on the called script to finish? I'm going back to the MSCI handbook and rereading that section lol
[ external 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!

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22224
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Thu, 13. Nov 14, 11:40

To start the command, there is a script command to do it, something like
$wing -> start wing command: COMMAND_WING_ATTACK, args=$target

this will start what ever script is connected to the command COMMAND_WING_ATTACK

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

Post by kaistern » Thu, 13. Nov 14, 11:49

Joubarbe wrote:Forget the @, you don't need to worry about that.
ok :D
Uhhh, just to be clear :

Code: Select all

!wing.cmd.attack.std
This is a script.

Code: Select all

call script
This is a command.
yup i must have misstyped somewhere
You have different way to call a script via your command. "= [THIS]" means you could have a return value given by the script you call (that could be "$MyReturnValue = [THIS]"). "START [THIS]" means you call the script on another "thread" and that won't return anything because your current script won't wait for it to finish.

And you call the script from "[THIS]" which is null, because it's a wing command.

You say you used START, no you didn't. You must write it manually.
I had it in there originally but took it out to test a theory that didn't pan out, and forgot to add it back. It's back now with a slight change in condition.... The ships still won't accept new orders however in global task list it shows "!wing.cmd.attack.std" instead of "Action1" I'm going to go back and reread cycrows post and see if i can get anything more out of it the fourth time :D
[ external 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: 443
Joined: Mon, 30. Jun 14, 13:29
x3ap

Post by kaistern » Thu, 13. Nov 14, 11:49

Cycrow wrote:To start the command, there is a script command to do it, something like
$wing -> start wing command: COMMAND_WING_ATTACK, args=$target

this will start what ever script is connected to the command COMMAND_WING_ATTACK
you ninja :D let me go try that
[ external 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!

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22224
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Thu, 13. Nov 14, 11:54

just checked, the command will be

Code: Select all

START $wing -> wing command: COMMAND_WING_ATTACK : arg1=$target, arg2=null, arg3=null, arg4=null

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

Post by kaistern » Thu, 13. Nov 14, 12:02

VICTORY!!!!!!!!!!!!!!!!!!!!!!!!!!!!

now just to try and make everything pretty, write the other three command scripts (I had to add a shield attack hotkey.... Dont know how I forgot it as it is one of the commands I use most) and then wrap everything up and upload it!


THANK YOU GUYS!!!!!!!!
[ external 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: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Post by Joubarbe » Thu, 13. Nov 14, 12:05

FYI, you can see all wing commands into the "Script Objects" tab in X-Studio (COMMAND_WING_ATTACK_SHIELDS, for instance).

If I may add a suggestion : a command to resupply/refuel would also be great :)

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

Post by kaistern » Thu, 13. Nov 14, 12:50

For you Jaubarbe, anything.

I'll add it
[ external 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”