[DISCUSSION+REGISTRATION] - MSCI Reference

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

Post Reply
User avatar
apricotslice
Posts: 13649
Joined: Sun, 16. May 04, 13:01
x3ap

Post by apricotslice » Sat, 19. May 12, 08:22

Its long overdue for those learning scripting.

Alas, the times I've tried to use it, the command I wanted info on hadnt been done yet.

@Argonaught, Rebirth wont use scripting in its current form, but apparently will have scripting in a more generic xml form. With luck, converting between them wont be difficult or someone will write a converter pretty quickly.

Likely the new script will have the same sort of functionality, just a different syntax.

And yes, its also way past time when the MD got the same treatment. I'd venture to say that this forum could be used as well for the MD to have it all in one place, just needs its own top threads.

Logain Abler
Posts: 2253
Joined: Mon, 31. Oct 05, 09:44
x4

Post by Logain Abler » Sun, 17. Jun 12, 19:04

Under Trade:
[skip|else] if [not]|while [not]| <RetVar/IF> = <RefObj> add <Var/Number> units of <Var/Ware>

<RetVar/IF> = If the command is to 'return' information. If a variable is used, This command will return TRUE on success, FALSE on failure.

When using on HQ class stations the command always returns 0.


LA

User avatar
mr.bear
Posts: 427
Joined: Sat, 11. Dec 10, 02:38
x2

Post by mr.bear » Sat, 18. Aug 12, 12:02

if you want to search the msci pages quickly, just use google. you can set it up to search only a specific site, then set that page as a favorite.

i have a button on my toolbar that links to:

https://www.google.co.uk/search?as_site ... gosoft.com

i just click the button and type in a command name. plus you get any related forum posts.

mr bear
Rapunzel, Rapunzel, let down your bear...

mark_a_condren
Posts: 1385
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren » Fri, 24. Aug 12, 10:15

Logain Abler wrote:Under Trade:
[skip|else] if [not]|while [not]| <RetVar/IF> = <RefObj> add <Var/Number> units of <Var/Ware>

<RetVar/IF> = If the command is to 'return' information. If a variable is used, This command will return TRUE on success, FALSE on failure.

When using on HQ class stations the command always returns 0.


LA
Done.

The English artical has been updated with the above info. Just needs a German translator to fix the German translation.

MarCon

shanrak
Posts: 587
Joined: Wed, 25. Feb 09, 06:54
x3tc

Post by shanrak » Mon, 18. Apr 16, 23:12

Can someone please help with the put into environment command?

I'm trying to write a script to move a ship/station:

Code: Select all

Argument 1: target Var/Ship/Station, 'target'
Argument 2: pos, Var/Sector Position, 'position'

$x = $pos[0]
$y = $pos[1]
$z = $pos[2]
$sec = pos[3]
write to player logbook: printf: fmt='Moving %s to %s (%s, %s, %s)', $target, $sec, $x, $y, $z
$target -> put into environment: $sec ->
$target -> set position: x=$x y=$y z=$z
It will print the right target, sector, and positions to the logbook.

So the object does move to the position I specify, but it doesn't change sectors. What am I doing wrong?

The put into environment entry in the MSCI Reference seems to be missing :roll:

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 20547
Joined: Mon, 15. Nov 04, 00:26
x4

Post by Cycrow » Tue, 19. Apr 16, 10:30

first off, what game is this for ?
as that command has been changed over the different versions

Is it a ship or station you are trying, have you tried both ?

also, try it without the set position command and see if that works

shanrak
Posts: 587
Joined: Wed, 25. Feb 09, 06:54
x3tc

Post by shanrak » Tue, 19. Apr 16, 11:37

Cycrow wrote:first off, what game is this for ?
as that command has been changed over the different versions

Is it a ship or station you are trying, have you tried both ?

also, try it without the set position command and see if that works
This is for x3 ap but with litcubes mod.

It doesn't move the either the ship nor the station to a new sector, even if I remove the set position command.

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

Post by Joubarbe » Tue, 19. Apr 16, 11:49

Try to create another script to call "put into environment" with a START keyword. Then in the same script, wait 100 ms, then use "set position".

shanrak
Posts: 587
Joined: Wed, 25. Feb 09, 06:54
x3tc

Post by shanrak » Tue, 19. Apr 16, 12:02

Joubarbe wrote:Try to create another script to call "put into environment" with a START keyword. Then in the same script, wait 100 ms, then use "set position".
Just tried it, behavior is still the same as before.

I also added a log line in the new script just to make sure its being called, and it does print.

I also tried hard coding in a sector in the put into environment script, that didn't work either :?

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

Post by Joubarbe » Tue, 19. Apr 16, 17:59

The following work fine for me :

Code: Select all

$x = $pos[0]
$y = $pos[1]
$z = $pos[2]
$sec = $pos[3]

$sector = [THIS]-> get sector

if $sec == $sector

  [THIS]-> set position: x=$x y=$y z=$z

else

  [THIS]-> put into environment $sec->

end
You can easily make a loop and break it after setting position.

shanrak
Posts: 587
Joined: Wed, 25. Feb 09, 06:54
x3tc

Post by shanrak » Tue, 19. Apr 16, 22:43

Joubarbe wrote:The following work fine for me :

Code: Select all

$x = $pos[0]
$y = $pos[1]
$z = $pos[2]
$sec = $pos[3]

$sector = [THIS]-> get sector

if $sec == $sector

  [THIS]-> set position: x=$x y=$y z=$z

else

  [THIS]-> put into environment $sec->

end
You can easily make a loop and break it after setting position.
So I tried it and it still doesn't work for me :/

I didn't try to put it in a loop but I did run it both when the target sector is the same as the current one and when it isn't.

The set position portion works if the target position is in the same sector, but its still not putting it into a new sector.

Image

*Update*

I just tried it on a ship and it worked, I guess "put into environment" isn't supposed to work on a station?
Last edited by shanrak on Tue, 19. Apr 16, 22:52, edited 1 time in total.

User avatar
Litcube
Posts: 4242
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Tue, 19. Apr 16, 22:49

You can't run that script command on [THIS]. Use an external script to run the command on the object.

shanrak
Posts: 587
Joined: Wed, 25. Feb 09, 06:54
x3tc

Post by shanrak » Tue, 19. Apr 16, 22:56

Litcube wrote:You can't run that script command on [THIS]. Use an external script to run the command on the object.
Are you referring to the put into environment command? It does seem to work when [THIS] is a ship though.

User avatar
Litcube
Posts: 4242
Joined: Fri, 20. Oct 06, 19:02
xr

Post by Litcube » Tue, 19. Apr 16, 22:57

Oh, ok. Maybe I'm wrong.

No, it won't work on a station.

shanrak
Posts: 587
Joined: Wed, 25. Feb 09, 06:54
x3tc

Post by shanrak » Tue, 19. Apr 16, 23:00

Litcube wrote:Oh, ok. Maybe I'm wrong.

No, it won't work on a station.
Thanks, that's all I had to know :D

So the only way to 'move' a station is to destroy it and make a new one in the new sector.

Post Reply

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