[Discussion] Generic X3TC S&M questions I
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 817
- Joined: Sat, 14. Oct 06, 01:01
Couple of questions:
1. Does anyone know the weapon value of the Tractor Beam in X3TC? Tried looking in Plugin Manager - Ship Creator, but those values are incorrect. Changing it to 64 gave it a High Energy Plasma Thrower instead.
2. Where is the Text name of a ship stored? I don't see any text names in Tships. ie: Hyperion, Nemesis, etc.. and how is the text name associated with the Tships entry?
Thanks!
-Grax
Edit: removed question #3. Figured that one out.
1. Does anyone know the weapon value of the Tractor Beam in X3TC? Tried looking in Plugin Manager - Ship Creator, but those values are incorrect. Changing it to 64 gave it a High Energy Plasma Thrower instead.
2. Where is the Text name of a ship stored? I don't see any text names in Tships. ie: Hyperion, Nemesis, etc.. and how is the text name associated with the Tships entry?
Thanks!
-Grax
Edit: removed question #3. Figured that one out.
Last edited by Graxster on Wed, 29. Oct 08, 22:03, edited 1 time in total.
-
- Posts: 4254
- Joined: Fri, 20. Oct 06, 19:02
Was going to do this myself until I ran into issues.Cycrow wrote:
i am working on a hotkey manager which should help things eventually i think
The global variables themselves don't seem to "refresh" properly/quickly. Meaning, the keys themselves, even if they have a value of "null" still show up in the "get global variables" return. Really odd. And sometimes, after setting one to null, the rest of them dissapear. Unexpected inconsitent results so far.
Cycrow, have you experienced this at all?
-
- Posts: 18
- Joined: Wed, 2. Aug 06, 22:26
yea basically a new custom start, like say Male Terran Soldier instead of just the female terran soldier and so on and so forth.ThisIsHarsh wrote:@ Litcube. I honestly thought of saying something similar when I saw RyuNoKami's first post. A bit consice to say the least...
@RyuNoKami: You mean you simply want a new custom start? or you want to add in features to make it feel more like you have D&D style character stats and a face and voice of a certain race, etc? Either can be done to an extent, the second option is not trivial though.
-
- Posts: 20
- Joined: Thu, 1. Jan 04, 23:07
Get functions for marine skills
I am working on script for marine training. Setting the fight/hack/Mechanical/Engineering values is clear and easy, but for the life of me I cannot find a set of get functions. Is there one, and where is it located? It would seem odd if there were not.
Also, where might I find instructions for unpacking the MD files, and instructions in their use? Is there a manual like the one for MSCI available someplace? I stopped playing X3R before the mission director came out, so I have no experience with it.
athelred
Also, where might I find instructions for unpacking the MD files, and instructions in their use? Is there a manual like the one for MSCI available someplace? I stopped playing X3R before the mission director came out, so I have no experience with it.
athelred
-
- Posts: 817
- Joined: Sat, 14. Oct 06, 01:01
OK, I'm stumped on this one. Can you not use a Hotkey on a script that requires an Argument? I wrote a script that has the argument Var Sector Position. Did the usual $x=$pos[0] $y=$pos[1], etc... then wrote a Hotkey setup script to call this script. When I press the Hotkey, it doesn't ask you to choose a Sector and Position, it just warps the ship to current sector, position 0,0,0. Thanks!
-Grax
P.S. When I run the script manually from the editor, it works fine.
-Grax
P.S. When I run the script manually from the editor, it works fine.
-
- Posts: 22541
- Joined: Sat, 23. Apr 05, 21:42
I would guess that script call via hotkey does not do the "fill in the arguments" routine like the calls via menu or from SE. But isn't there now a SE command to pop up an inputdialog within code, or is that for strings only?
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.
Insanity included at no extra charge.
There is no Box. I am the sand.
-
- Posts: 817
- Joined: Sat, 14. Oct 06, 01:01
-
- Moderator (Script&Mod)
- Posts: 22437
- Joined: Sun, 14. Nov 04, 23:26
no, hotkeys do not run the arguments. In X3, the only way to get those kind of thigns to work is if you added a command and used that via the ships command console.Graxster wrote:OK, I'm stumped on this one. Can you not use a Hotkey on a script that requires an Argument? I wrote a script that has the argument Var Sector Position. Did the usual $x=$pos[0] $y=$pos[1], etc... then wrote a Hotkey setup script to call this script. When I press the Hotkey, it doesn't ask you to choose a Sector and Position, it just warps the ship to current sector, position 0,0,0. Thanks!
-Grax
P.S. When I run the script manually from the editor, it works fine.
however, in TC, there are other ways. What you want is the get user input command to do that. Basically it works like the arguments but can be anywhere in your script
Code: Select all
$pos = get user input: type = Var/Sector Position, title="Select position"
-
- Posts: 817
- Joined: Sat, 14. Oct 06, 01:01
As I said in the post above yours, I tried that. Added:
Still get no user input option, and I get warped to 0,0,0.
-Grax
Code: Select all
$pos = [THIS] -> get user input, type: Var/Sector Position, title='Select a Position'
-Grax
-
- Moderator (Script&Mod)
- Posts: 22437
- Joined: Sun, 14. Nov 04, 23:26
-
- Posts: 817
- Joined: Sat, 14. Oct 06, 01:01
It was added as the first line of the script. As far as [THIS] not working globally, I had to put something in there. There's only one command available, and you need 2 variables at the beginning of the line. Anyway, I figured out one problem. Once the game gets a script into memory it won't read the script if you change it. Reinit script cache doesn't seem to help. Quitting and restarting the game made it work.
Now the problem is that once I choose a sector and position, nothing happens.
That works perfectly if I delete the first line and use an Argument Var/Sector Position and run it from inside the script editor.
-G
Now the problem is that once I choose a sector and position, nothing happens.

Code: Select all
001 $pos = [THIS] -> get user input: type=Var/Sector Position, title='Select a Position'
002 if $pos -> exists
003 |$curSector = [PLAYERSHIP] -> get sector
004 |$x = $pos[0]
005 |$y = $pos[1]
006 |$z = $pos[2]
007 |$sector = $pos[3]
008 |if $curSector == $sector
009 ||[PLAYERSHIP] -> set position: x=$x y=$y z=$z
010 |else
011 ||[PLAYERSHIP] -> put into environment $sector ->
012 |end
013 @ |= wait 2500 ms
014 |[PLAYERSHIP] -> set position: x=$x y=$y z=$z
015 end
016 return null
-G
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
-
- Posts: 697
- Joined: Sat, 21. Oct 06, 08:09
I want to get an array of player-owned ships....
Am I stuck using the command:
$array = get ships owned by <Player> of type <Object Class>
for every single ship class (M1,M2,M3,M4) and then concatenating the arrays, or is there an easier way of doing it? I've searched, and can't find anything easier. ><
~ Tatakau
Am I stuck using the command:
$array = get ships owned by <Player> of type <Object Class>
for every single ship class (M1,M2,M3,M4) and then concatenating the arrays, or is there an easier way of doing it? I've searched, and can't find anything easier. ><
~ Tatakau
-
- Moderator (Script&Mod)
- Posts: 22437
- Joined: Sun, 14. Nov 04, 23:26
yeah exist really wouldn't work for what you want.
as tatakau said, its checking if the varible is an actualy object, arrays are not objects so it'll always be false.
the easiest way would be a simple
the better way would be
EDIT: might as well exactly what the [THIS] is used for. It really depends on what varible type you are using, some of them do require to be run on a certain object, ie, ware of ship, would have to be run on a valid ship.
but most of them dont need to use it. However, some things like Var/Sector and Var/Sector position, will center on the objects sector.
ie, if [THIS] was a ship thats in Getsu Fune, for example, then when it opens up the menu, Getsu Fune will be the highligheted sector.
i would suggest using [PLAYERSHIP]
as tatakau said, its checking if the varible is an actualy object, arrays are not objects so it'll always be false.
the easiest way would be a simple
Code: Select all
if $pos
Code: Select all
if is datatype [ $pos ] = DATATYPE_ARRAY
but most of them dont need to use it. However, some things like Var/Sector and Var/Sector position, will center on the objects sector.
ie, if [THIS] was a ship thats in Getsu Fune, for example, then when it opens up the menu, Getsu Fune will be the highligheted sector.
i would suggest using [PLAYERSHIP]
-
- Posts: 817
- Joined: Sat, 14. Oct 06, 01:01
WTH?ThisIsHarsh wrote:I think "if $pos -> exists " is a bit wrong, IIRC it returns if an object in the universe exists, not if something is null or not, for that you can just use "if $pos".

Too many 4AM nights I guess, hehe. Changed it to "if $pos != null" and we're in business! Thanks!
On another note, any idea how to subtract money from the player with a variable? The only command I see is "add money to player". While you can subtract using a negative number, you can only enter either a number or a variable, and no minus sign. Here's what I'm trying to do:
get the amount of energy cells needed for a jump ($needed.eCells)
check cargo for the needed eCells ($actual.eCells)
if $needed.eCells > $actual.eCells
$cost = $needed.eCells * 25
(charging him 25 credits per eCell)
Now how do I subtract minus $cost from player money?
-Grax
-
- Moderator (Script&Mod)
- Posts: 22437
- Joined: Sun, 14. Nov 04, 23:26
simple this one
also, you do the same thing to remove wares from ships, as there is only an add command, not remove command
Code: Select all
$cost = - $cost
add money to player acount $cost
-
- Posts: 817
- Joined: Sat, 14. Oct 06, 01:01
Anyone have any idea how the game makes products vanish? And if it's possible for scripters/modders to use this function?
Example: In both X3R and X3TC I've never purchased a single Nav Satellite (only use advanced sats), yet Satellite Factories continue to produce sats, which are purchased and sold at Trading Stations or wherever, but eventually they vanish. Otherwise most factories that don't produce common consumables (like energy cells or food) would all eventually fill up. Or perhaps a better example is space fuel. Everyone knows space fuel distilleries are huge money makers, but how does the game make NPC's "consume" it?
-Grax
Example: In both X3R and X3TC I've never purchased a single Nav Satellite (only use advanced sats), yet Satellite Factories continue to produce sats, which are purchased and sold at Trading Stations or wherever, but eventually they vanish. Otherwise most factories that don't produce common consumables (like energy cells or food) would all eventually fill up. Or perhaps a better example is space fuel. Everyone knows space fuel distilleries are huge money makers, but how does the game make NPC's "consume" it?
-Grax
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
afaik they are removed randomly via Hardcode... there is no possibility to use this function, switch it of or to have any influence on it...
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 817
- Joined: Sat, 14. Oct 06, 01:01
So if I use the RelVal of Space Fuel my ware will "vanish" over time?Cycrow wrote:its not randomly, its based on the wares relval. But it is hardcoded.
you can make it do yourself easy enough. Just a simple script that removes wares from stations over time
Another question:
I'm calling the script, "move.jumptostation", then I have "while not [THIS] is docked" "@ = wait randomly from 3000 to 5000ms". I need some way to break out of this if for some reason the ship can't dock (station exploded, or some other unforeseen event is preventing docking). Any way to add a timeout or something in that loop? Or should I just add checks for "if $station exists", if docking is allowed, etc. and hope he doesn't get stuck in a loop? Thanks!
-Grax
Edit: Also, I'm having a problem creating factories with a script. I have a script that creates a factory in 2 sectors, the problem is that no matter what I do, it will only create the first factory and not the second. The scripting is identical from the 1st to the 2nd, with only the variable for the factory different (ie: $fac1 = create station Argon Prime, $fac2 = create station Kingdom End). I know the build part works, because if I comment out the entire first fab, the 2nd will get built. Any ideas?