[Discussion] Generic X3TC S&M questions I

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

Rheinlander
Posts: 126
Joined: Sat, 4. Mar 06, 07:51
x4

Post by Rheinlander »

Gazz wrote:The only problematic item would be, that your new corporation would not be displayed along with the other corps ranks on the player pilot screen.

Which "factions" are displayed there is hardcoded AFAIK and there is no workaround short of replacing an existing race/corp.

Thanks for the quick response. I don't mind it not being listed as an actual corp/faction though.


I've also been wondering if it's possible to create player-owned job entries/job wings that can be triggered via a custom script menu.
Kicking bastu and taking names since X:BTF
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22415
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

Rheinlander wrote:
Gazz wrote:The only problematic item would be, that your new corporation would not be displayed along with the other corps ranks on the player pilot screen.

Which "factions" are displayed there is hardcoded AFAIK and there is no workaround short of replacing an existing race/corp.

Thanks for the quick response. I don't mind it not being listed as an actual corp/faction though.


I've also been wondering if it's possible to create player-owned job entries/job wings that can be triggered via a custom script menu.
if u use the MD to create a faction, then it will be displays in the factions list.

you can then use the script commands to change its notority. But it first must be have its name and rank texts assigned via the MD
Rheinlander
Posts: 126
Joined: Sat, 4. Mar 06, 07:51
x4

Post by Rheinlander »

Cycrow wrote: if u use the MD to create a faction, then it will be displays in the factions list.

you can then use the script commands to change its notority. But it first must be have its name and rank texts assigned via the MD
Oh awesome, that's great news.
Kicking bastu and taking names since X:BTF
ladyboy
Posts: 69
Joined: Fri, 14. Sep 07, 19:18

Post by ladyboy »

Got a script that makes all player ships jump to a position but there's a problem, the ships only jump if they are doing something... Moving, Attacking, Idle but not if they are stopped. anybody know what the problem could be?

I'm using "Interrupt with script" to make the ships call the jumping script. could it be something to do with "and prio" ?? what does and "prio do"?
All those moments will be lost.. in time, like tears.. in rain.
[ external image ]
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

ladyboy wrote:Got a script that makes all player ships jump to a position but there's a problem, the ships only jump if they are doing something... Moving, Attacking, Idle but not if they are stopped. anybody know what the problem could be?

I'm using "Interrupt with script" to make the ships call the jumping script. could it be something to do with "and prio" ?? what does and "prio do"?
I think interrupt only works if there is a script running to interrupt. So you need to have something like:

if $ship->is task 0 in use
$ship->interrupt task 0 with script ...
else
START $ship->call script ...
end

Prio limits the ability of your interrupt. A prio of less than 100 (I think) means your script can't interrupt the SIGNAL_ATTACKED script. There are a bunch of others. I think SIGNAL_KILLED is prio 10000. There's also the !fight.defendsector scripts which run at prio 40... etc, etc.
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
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

You can make dynamical sektorcenes with cut-files (remember the city-flight in X3R) ...
Question: Can anyone explain to me a little bit more about this?
e.g. Where are the cut-files physically kept, how do you get them in game (in sector), how do you edit them etc.
*edit* Right, the object cuts, which means I'd dbox/max them. But how would I get them in game, with out importing them as ships. (I don't want "floors" to be targetable)

Context: What I'm trying to do is get a "floor" in the game (so I can build the interior of ships for marine ship boarding combat). Essentially, just a flat textured square, possibly with walls which can collide with objects (as I don't want lasers flying through walls between rooms).
The actual marines "in the ship" will have collisions off, so way-pointing/collision avoidance is not an issue.







Q: Tasks and re-starting
(I'm fairly sure the answer is yes) If I have THIS, running a task on say 7742, and on 0. And the script on 0 says start a task on 7742, does it replace the existing 7742 task with the new one?
And when does it "start" the new task? Right away, when the task 0 reaches the next interrupt? When the 7742 reaches the next interrupt?
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

Has anyone had any experience with the regular expressions script command?

A very handy command. But I can't get it to recognize tabs, i.e. '\t' doesn't work, neither does '\\t'.

Any ideas?
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.
jlehtone
Posts: 22477
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone »

Whitespaces are not mentioned here. Omission in documentation, or in implementation?

One could naturally try

Code: Select all

[^a-zA-Z0-9 ]
to rule out most "other" characters, but that is clunky.
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

jlehtone wrote:Whitespaces are not mentioned here. Omission in documentation, or in implementation?

One could naturally try

Code: Select all

[^a-zA-Z0-9 ]
to rule out most "other" characters, but that is clunky.
Ah didnt realized Xai Corp MSCI was updated with new commands. Indeed it looks like 'special characters' only include escaping operators to use them as a part of the string query.

Unfortunately, I need to be able to detect non-alphanumeric characters as well, so I may have to use

Code: Select all

[^{}\[\]"a-zA-Z0-9]
... (plus every other character possible except whitespace) or something similar.
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
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

I know this is probably wishful thinking, but it can't hurt to ask (once)

I don't suppose there is some notation on the new 2.5 script editor commands


And can anyone else confirm that there is a bug with the new script commands (all of them)

Get Font string length just shows up as a blank line. (It appears to want to have two as you can scroll right once)
Neither do the new set/get desired speed show up on my s.e....
Nor the add/remove encyclopaedia ones.
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22415
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

this is common when the script editor gets an update.

basically, save games will not be able to see the new commands

to use them, u'll need to do them in a new game from 2.5

however, once u have added them, they will work in older save games, u just wont be able to edit them correctly unless u do it in a game started with 2.5
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Bah :(

I just posted it as a bug in the tech support... :S
Hold on, I'll remove my bug report, btw I also made one on the total marine count being displayed incorrectly.





Q: Corporation Rank Titles,
Where do you define them? As I've noticed that using the S.E to set them, just causes them to show the rank as a number (presumably indicating the rank in numeric form, e.g. 0-100 is rank 3, 100 - xxx is rank 4 etc)

Q2: How would you put a custom corporation in the Encyclopaedia?
As in, how would you get it into the corporations section?
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22415
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

s9ilent wrote:Q: Corporation Rank Titles,
Where do you define them? As I've noticed that using the S.E to set them, just causes them to show the rank as a number (presumably indicating the rank in numeric form, e.g. 0-100 is rank 3, 100 - xxx is rank 4 etc)
they have to be initialised first before u can use them.
this is done via the MD
s9ilent wrote:Q2: How would you put a custom corporation in the Encyclopaedia?
As in, how would you get it into the corporations section?
this isn't any way to add it to the encyclopedia, unless u add it to the custom the section.

the corporations are linked to the station type of thier HQ's
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Thanks for the replies Cycrow :)




Q: Custom Signal_attacked. Is anyone else having issues with this (with either primary or secondary signals?)

I'm having issues with it... in that if I set a custom script to it, it never seems to fire. But my custom secondaries seem to fire fine. But then Gazz made his tertiary signals because he found that the primaries worked, but not the secondaries???

Do Primary signals need to have be a ! script or something?
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22415
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

afaik, the primarys and secondarys should be firing at the same time.

did u attach both to the same ship to test it ?
making sure that the secondary returns immediataly, otherwise it could prevent others from working

Signal_attacked doesn't fire each time a ship is hit, but when it actually think its being attacked. This means a few stray shots wont trigger it.
when u attack a non hostile ship, u have to attack it a few times before they will turn enemy. When they turn enemy is when it will fire and not the times before that
ladyboy
Posts: 69
Joined: Fri, 14. Sep 07, 19:18

Post by ladyboy »

i'm a bit stuck with something... again :)
I have an argument that calls for the player to select a ship - $tgt.ship

is there a way to send $tgt.ship to other scripts when i call them?
or would i have to select the target ship every time for each script?

I've been read up on arguements and parameters when you call a script but i'm a bit confused.
All those moments will be lost.. in time, like tears.. in rain.
[ external image ]
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

I didn't do a complete test, but here is what I did

(My signal does a few things, but I put a logbook print at the top of it, whilst doing theses tests)

The script that I'm using to be 'fired' is... plugin.sfm.ship.signal.attacked, which I made in the exscriptor (hence why it probably has a name longer then the in game script editor allows - although I have not had any issues with that in the past, and I would like to think that it is not correlated with signals)

Test 1. On my Boron SF, it was running my SFM command. I set the PRIMARY signal_attacked to the custom script, it didn't fire.
I tried to fire it by huge amounts of friendly fire, and then by fly commands -> send signal signal_attacked null null null null

Test2. On my flak frigate (that is set to Standby -made for easier testing). Set it to the the primary signal. Did not fire
I tried to fire it by huge amounts of friendly fire, and then by fly commands -> send signal signal_attacked null null null null

Test3 Set it to an NPC goner ship (the flagship goner one, it was close and it's slow). Set the primary signal, it did not fire
I tried to fire it by huge amounts of friendly fire, and then by fly commands -> send signal signal_attacked null null null null

Test4. The goner ship again, I returned the primary to it's default behaviour. Then I my script as a secondary signal (and I set the primary signal to !lib.interupt as a precaution, which is just a return null script)
Viola!! It worked.
I shot at it a few times and the signal fired.



?Test5? I used the my plugin.sfm.signal.attacked (but with out the logbook print) as the primary signal on my SFM transports. And I was observing one when it was attacked (with extra information on). The script priority was at 0, and the signal.attacked script was NOT running on it. (And it was being attacked by pirate ships, and was destroyed about after about 40 seconds, during which time the signal never appear to fire)


On a final note, I'm 99% sure my signal script works, as it used to work before (I think I may have had it as a secondary signal back then thou) and I have made no changes to it for quite some time.


I've yet to completely test this in all it's variations (pri + sec, just pri, just sec, + on npc, on pc, on player, on task 0 inactive etc.), but I found the results odd as Gazz made his tertiary signal scripts because the primaries worked but not the secondaries, but for me it seems the other way around :S
(A quick run down of what my script does is, fighter drones, run away to homebase/random npc station). My script does NOT return right away, as it does fly tasks. (It was meant to replace the original primary signal)




@ladyboy w.r.t Arguments
Scripts can have arguments, and it is one method of passing information to scripts (the second being global/local variables / other in game passable information. e.g. object names)

They are passed each time you call the script

e.g.
<return> = <object> -> call script 'script' : <arg1> 2 3 4 5
In the main script
$ret = [THIS] -> call script 'yourscript_2' : $targ

Then in the second script, it will have a variable called $targ, which will be the same value which you just passed it from the main script.



However, if you want e.g. some script to run on $targ. Then some time later, a DIFFERENT script that is completely isolated from the first to also run on $targ, then you should use a local/global variable.
e.g. On each of the different scripts you have something like this

Code: Select all

$targ = get global variable 'ladyboy.var'
if not $targ -> exists
 $targ = Ask player, select a ship (i forgot the syntax for this command, but its under Other commands)
 if $targ -> exists
  * save the $targ information for use next time
  set global variable 'ladyboy.var' to value $targ
 else
  return null
 end
end
Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22415
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow »

Secondary signal attacked was fixed in2.5

Primary wasn't changed thou

Signal scripts should need to return immediately especially secondary as the are run in sequence
If u have and delays or waits then u need to run it in a separate script
Either fork a new global task or start it on a different task

If u have secondaries that don't return the primary will never be run
User avatar
Gazz
Posts: 13244
Joined: Fri, 13. Jan 06, 16:39
x4

Post by Gazz »

s9ilent wrote:(A quick run down of what my script does is, fighter drones, run away to
Drones may very well be special or may have the signal disabled in the INIT file. Did ya look there?

My script does NOT return right away, as it does fly tasks. (It was meant to replace the original primary signal)
That's not a good idea because this blocks any and all signal scripts, not just attacked.
Would be better to put these in a second script, interrupting task0 with a delay while the real signal script returns.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

Sorry, what I meant is, it runs on TS ships, the signal launches drones, then runs away.

My script was meant to replace the original primary signal, (hence why non instant return). But for now, I'm putting it as a sec as its failing rather badly :(

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