My posts are like my scrips, never right the first time round.EmperorJon wrote: Oh, and I see you added someone to that list since I last looked.
[Discussion] Generic X3TC S&M questions II
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 2033
- Joined: Wed, 29. Jun 05, 01:45
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.
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.
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
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...
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!

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...

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!


______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Mh, normally comparing sectors works just as comparing all other variables:
Greetings,
ScRaT
Code: Select all
$playerSector = [PLAYERSHIP] -> get sector
$someSector = get sector from universe index: x=$x, y=$y
if $playerSector == $someSector
* Do something
else
* ...
end
You could post only the relevant code, where you set and compare the involved variables.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...
Greetings,
ScRaT
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
I've been adding all sorts of failsafes and stuff...
This is just how I work ok? 
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.
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]

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.

______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 17
- Joined: Tue, 7. Jul 09, 14:19
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.
What is the best way?
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
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
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.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.What is the best way?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
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.
Black holes are where God divided by zero.
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
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?
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.
Black holes are where God divided by zero.
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
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...
Would my best alternative be running another script from there to command the ship?
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...

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.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
Of course, should have thought of this. That explanation fits what I see nicely.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*'
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'.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...
Would my best alternative be running another script from there to command the ship?
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.
Black holes are where God divided by zero.
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 851
- Joined: Fri, 13. Jun 08, 13:14
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.
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.
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
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: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.
= [THIS]->call script '!ship.cmd.movesector.std' : sector=$sector
= [THIS]->call script '!ship.cmd.killenemies.std' :
should work.
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.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.
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.
Black holes are where God divided by zero.
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
-
- Posts: 851
- Joined: Fri, 13. Jun 08, 13:14
heh well its better than nothing. Its quite a nice iea actually..grenae launchersThisIsHarsh 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.

rocket launchers (i.e. bullets that look like Dumbfire) are another possibility..no tracking ability but at least they woul look like missiles.
Woul this nee to be Dynamic for new ships aDDeD etc or just to buil up a static reference library?ThisIsHarsh wrote:Anyone know any resource or simple method whereby I can obtain the exact notoriety gains/losses caused by killing enemy/friendly ships?
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.
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
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...Coruskane wrote:Woul this nee to be Dynamic for new ships aDDeD etc or just to buil up a static reference library?ThisIsHarsh wrote:Anyone know any resource or simple method whereby I can obtain the exact notoriety gains/losses caused by killing enemy/friendly ships?
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.
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.
Black holes are where God divided by zero.