[Discussion] Generic X3TC S&M questions II

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

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

Logain Abler
Posts: 2255
Joined: Mon, 31. Oct 05, 08:44
x4

Post by Logain Abler »

EmperorJon wrote: Oh, and I see you added someone to that list since I last looked. :P
My posts are like my scrips, never right the first time round.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

To use colours in message tag's you need to use the older [green]Message[/green]
For everything else you use the /xxxx colour tags.

It is a strange thing in X3TC only, as in X3R you could use either colour tag for messages.





To dock with a ship, I'm pretty sure you just moveto.movetostation
And I'm fairly certain that it calls signals and other misc stuff.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Sorry about being a nuisance again but I've got another nasty one...

Basically it says:

Get the player's sector.
If the player's sector is not (certain sector)
Go to a fail statement
(Unless a certain amount of time has passed, in which case go to the next script section)

If the player's sector is a certain sector, go back to the beginning.

Somehow, I have an if and else if statement which isn't working... it's odd...


Because I know that the sector IS the certain sector. And yet it's still acting as if it was neither and continuing.

I even put a readout saying 'The expected sector is %s, you're in the %s, it is failing.' as debug, and got 'The Wall' in both.

So I thought, ok, variables mixed up somewhere?

Can't see them.


I'm not going to post it because I'm an extremely messy scripter, and this one's full of Go Tos and ifs and else ifs, and skips and... :P

Any ideas?

Want to see it? If so, I'll PM it.

Oh, and I also, whilst making it, got the SE to say there was no end statement to the conditional statement in line -1! :lol: :?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

Mh, normally comparing sectors works just as comparing all other variables:

Code: Select all

$playerSector = [PLAYERSHIP] -> get sector
$someSector = get sector from universe index: x=$x, y=$y
if $playerSector == $someSector 
  * Do something
else
  * ...
end
I'm not going to post it because I'm an extremely messy scripter, and this one's full of Go Tos and ifs and else ifs, and skips and...
You could post only the relevant code, where you set and compare the involved variables.

Greetings,
ScRaT
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

I've been adding all sorts of failsafes and stuff...

Code: Select all

102   Back2:
103 @ = wait 1000 ms
104   inc $TimeCheck = 
105   $String =  convert number $TimeCheck to string
106   display subtitle text: text=$TimeCheck duration=1000 ms
107   $PlaySec = [PLAYERSHIP] -> get sector
108   if $PlaySec != $Sector
109   |if $TimeCheck < 180
110   ||goto label Fail
111   |else if $TimeCheck >= 180
112   ||goto label Back3
113   |end
114   else if $PlaySec == $Sector
115   |if $TimeCheck >= 180
116   ||$F = sprintf: fmt='Now feel free to move on to %s.', $Sector2, null, null, null, null
117   ||send incoming message $F to player: display it=[TRUE]
118   ||goto label Back2
119   |end
120   else
121   |goto label Back2
122   end
123   
124   $F = sprintf: fmt='%s is wrong?', $Sector, null, null, null, null
125   send incoming message $F to player: display it=[TRUE]
126   
127   send incoming message 'Cheating reached 3.' to player: display it=[TRUE]
This is just how I work ok? :roll:

Well, I get...
if $PlaySec != $Sector
else if $PlaySec == $Sector
else
On the same line, which should cover all routes yes? But I still get the error messages. :P
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

And where do you assign $Sector?

Greetings,
ScRaT
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

I've got it working now anyway. Nothing some shouting and keyboard hitting won't do.

That's almost all the scripts half finished. :roll:
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
Gyver162
Posts: 17
Joined: Tue, 7. Jul 09, 14:19
x3tc

Post by Gyver162 »

I have a question: how to secure one of navigation commands (in my example "Jump and dock in homebase") from showing off for ships that don't have selected home base.

Example of code for navigation command in setup file.

Code: Select all

set script command upgrade: command=$cmd  upgrade={Navigation Commands MK1}  script='!ship.cmdcheck.jump'
global script map: set: key=$cmd, class={Moving ship}, race={Player}, script='plugin.paulp.gatelessjump.dock.home', prio=5
What is the best way?
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

Gyver162 wrote:I have a question: how to secure one of navigation commands (in my example "Jump and dock in homebase") from showing off for ships that don't have selected home base.

Example of code for navigation command in setup file.

Code: Select all

set script command upgrade: command=$cmd  upgrade={Navigation Commands MK1}  script='!ship.cmdcheck.jump'
global script map: set: key=$cmd, class={Moving ship}, race={Player}, script='plugin.paulp.gatelessjump.dock.home', prio=5
What is the best way?
You replace '!ship.cmdcheck.jump' with your own script that returns [TRUE] if the command is allowed to appear and [FALSE] otherwise. Actually this is a simplification. You should use the constants CmdCheck.Available and CmdCheck.Infinite, respectively. There are also other CmdCheck constants e.g. greying out the command (visible but not selectable), amongst others.
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.

Black holes are where God divided by zero.
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

I'm coming across a weird problem, where I spawn a ship via the cheat plugin and occasionally (seemingly randomly) a couple of seconds after it spawns it explodes for no reason.

Anyone any ideas what could cause this?
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.

Black holes are where God divided by zero.
Gyver162
Posts: 17
Joined: Tue, 7. Jul 09, 14:19
x3tc

Post by Gyver162 »

ThisIsHarsh wrote:...
Thanks a lot :)
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Probably GoD.

Does that a lot. Checks up on ships and says, 'Hey, this Argon ship isn't running any scripts! Must be part of a runaway mission or something. *presses Del*'
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Let's say I want to tell a ship to move to a sector and then attack all enemies.

There doesn't seem to be a command.

It's easy enough to say if it's not in the sector don't do anything. When it is, attack all enemies.

But not when it's in the middle of the looping script which spawns 2 whole armies and has to wait for each one to do that... :roll:

Would my best alternative be running another script from there to command the ship?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

EmperorJon wrote:Probably GoD.

Does that a lot. Checks up on ships and says, 'Hey, this Argon ship isn't running any scripts! Must be part of a runaway mission or something. *presses Del*'
Of course, should have thought of this. That explanation fits what I see nicely.

EmperorJon wrote:Let's say I want to tell a ship to move to a sector and then attack all enemies.

There doesn't seem to be a command.

It's easy enough to say if it's not in the sector don't do anything. When it is, attack all enemies.

But not when it's in the middle of the looping script which spawns 2 whole armies and has to wait for each one to do that... :roll:

Would my best alternative be running another script from there to command the ship?
If I understand correctly, then best thing to do is write your own command script, which simply takes a sector as a parameter, then calls 'movesector' immediately followed by 'killenemies'.
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.

Black holes are where God divided by zero.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

I made a script calling them and it just overwrote movesector with killenemies. So I've put the waiting in it, with it called seperately using START it's not in the way of the other script.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
Coruskane
Posts: 851
Joined: Fri, 13. Jun 08, 13:14
x4

Post by Coruskane »

spawning "launcheD" missiles:

is it possible? I have trieD spawning via object class etc but it just plonks a big station Debris instea.

I am exploring workarouns for ways to effectively have main guns an what works as a missile battery.

I can get a fighter to have missile batteries an 'main-guns' by spoofing main guns in a turret an linking their fire control to a player-control..but it is less than preferable.

Instea, is it possible to spawn missiles in flight? I coul then correspon the spawn point an trigger to the firing of a another weapon (e.g. laser Designator) in combination with get x/y/z an get rotation.

P.s. a Venti moDDeD so that its two gatling guns are missile launchers then linke to a player control looks increible.. A heavy centaur also looks nice as the harpoints are sprea out so.

p.p.s hmm..I coul try warping a launche missile immeDiately after launch.
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

EmperorJon wrote:I made a script calling them and it just overwrote movesector with killenemies. So I've put the waiting in it, with it called seperately using START it's not in the way of the other script.
Well you should check into your code a bit. Calling movesector followed by killenemies should definitely work I.e. a script with a $sector parameter and just two lines of code:

= [THIS]->call script '!ship.cmd.movesector.std' : sector=$sector
= [THIS]->call script '!ship.cmd.killenemies.std' :

should work.

Coruskane wrote:spawning "launcheD" missiles:

is it possible? I have trieD spawning via object class etc but it just plonks a big station Debris instea.

I am exploring workarouns for ways to effectively have main guns an what works as a missile battery.

I can get a fighter to have missile batteries an 'main-guns' by spoofing main guns in a turret an linking their fire control to a player-control..but it is less than preferable.

Instea, is it possible to spawn missiles in flight? I coul then correspon the spawn point an trigger to the firing of a another weapon (e.g. laser Designator) in combination with get x/y/z an get rotation.

P.s. a Venti moDDeD so that its two gatling guns are missile launchers then linke to a player control looks increible.. A heavy centaur also looks nice as the harpoints are sprea out so.

p.p.s hmm..I coul try warping a launche missile immeDiately after launch.
AFAIK there is no way to spawn launched missiles. One trick I have seen before, used in RRF, is using SQUASH mines. Once spawned, you can use the 'destruct' command to make them explode and cause damage. By stacking multiple mines you can create more destruction.

Not exactly what you were after, but I have a feeling its the closest you're gonna get.
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.

Black holes are where God divided by zero.
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

Anyone know any resource or simple method whereby I can obtain the exact notoriety gains/losses caused by killing enemy/friendly ships?
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.

Black holes are where God divided by zero.
Coruskane
Posts: 851
Joined: Fri, 13. Jun 08, 13:14
x4

Post by Coruskane »

ThisIsHarsh wrote: AFAIK there is no way to spawn launched missiles. One trick I have seen before, used in RRF, is using SQUASH mines. Once spawned, you can use the 'destruct' command to make them explode and cause damage. By stacking multiple mines you can create more destruction.
heh well its better than nothing. Its quite a nice iea actually..grenae launchers :)

rocket launchers (i.e. bullets that look like Dumbfire) are another possibility..no tracking ability but at least they woul look like missiles.
ThisIsHarsh wrote:Anyone know any resource or simple method whereby I can obtain the exact notoriety gains/losses caused by killing enemy/friendly ships?
Woul this nee to be Dynamic for new ships aDDeD etc or just to buil up a static reference library?

What about spawning a clone of the ship in the Dummy sector, getting notoriety, Destroying it, getting new notoriety, subtract accorinly to work out the Difference, an then give notoriety back to make no net Difference.

This might leaD to "You have lost recognition" Betty etc. However, if the amount of recognition gain/loss is a Deterministic function of the ship relval then the above metho coul return a set of Data to Derive the relationship from, which woul then be use in the enD user script.



sorry about the "D"s.. Something with TC/Drivers/OS etc is causing the lowercase to stop working after X3 has been run once, until I reboot. Sooo annoying.
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

Coruskane wrote:
ThisIsHarsh wrote:Anyone know any resource or simple method whereby I can obtain the exact notoriety gains/losses caused by killing enemy/friendly ships?
Woul this nee to be Dynamic for new ships aDDeD etc or just to buil up a static reference library?

What about spawning a clone of the ship in the Dummy sector, getting notoriety, Destroying it, getting new notoriety, subtract accorinly to work out the Difference, an then give notoriety back to make no net Difference.

This might leaD to "You have lost recognition" Betty etc. However, if the amount of recognition gain/loss is a Deterministic function of the ship relval then the above metho coul return a set of Data to Derive the relationship from, which woul then be use in the enD user script.
Better if it's dynamic, though I don't really need a precise reference. I could collect the stats myself, but (1) this is tedious; and (2) I have a feeling notoriety changes are a bit more complex than static quantities and there is some formula that links e.g. current player notoriety, notoriety of ship vs. sector, player fight rank, etc, etc. But I just don't know...
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.

Black holes are where God divided by zero.

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