[Discussion] Generic X3TC S&M questions I
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
Code like that is what nerd moms show their nerd kids to scare them into eating their veggies.
Direct jumps out of a while loop and to the same subroutine? *shudder*
Do you know where the next Return will lead? Maybe into a loop that now has an undefined beginning and condition?
It takes an interpreter with a strong stomach to digest this kinda recursion.
Write a better loop instead and get used to Continue and Break. =)
That is infinitely easier to debug, too.
Well, unless you have one of those newfangled 7-dimensional brains and the above code and all it's resulting recursions is perfectly clear to you.
Direct jumps out of a while loop and to the same subroutine? *shudder*
Do you know where the next Return will lead? Maybe into a loop that now has an undefined beginning and condition?
It takes an interpreter with a strong stomach to digest this kinda recursion.
Write a better loop instead and get used to Continue and Break. =)
That is infinitely easier to debug, too.
Well, unless you have one of those newfangled 7-dimensional brains and the above code and all it's resulting recursions is perfectly clear to you.
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.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
-
- Posts: 283
- Joined: Sun, 3. Aug 08, 20:30
I just checked and I was right...there is a rift in our universe. It's causing our physical laws to become more like the universe it is connected to. In no time at all, causality itself will become distorted. Quick, someone divide by zero! Hopefully that will save us all!
"Humanity has the stars in its future, and that future is too important to be lost under the burden of juvenile folly and ignorant superstition." - Isaac Asimov
-
- Posts: 1399
- Joined: Wed, 6. Nov 02, 20:31
Mobius strip animation
Sorry couldn't resist.
Also remember you can use internal script calls as functional elements in a script to reduce the amount of duplicated tasks by using the return variable. This is marginally slower than keeping things in a routine and obviously can be compounded further if used within nested while loops. So it isnt the best choice for performance/optimization but may help with some scripts.
Sorry couldn't resist.
Also remember you can use internal script calls as functional elements in a script to reduce the amount of duplicated tasks by using the return variable. This is marginally slower than keeping things in a routine and obviously can be compounded further if used within nested while loops. So it isnt the best choice for performance/optimization but may help with some scripts.
-
- Posts: 99
- Joined: Thu, 28. Oct 04, 18:50
I don't follow, are you saying I can get around using a tfile by using a sprintf command in my script?s9ilent wrote: ...
Everything else ONLY use \033R type colour flags. And these tags have to be imported from a tfile (thou you can sprintf something like \033R%s\033X if you need a more generic option). e.g. This can include: Object names, menu's, command related stuff, al plugins etc. everything except logbooks. These can NOT take format tags (AFAIK)
Space Cowboy - http://www.myspace.com/hardknight
"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion.
I watched C-beams glitter in the dark near Tannhäuser Gate. All those moments will be
lost in time, like tears in rain." - R. Batty
HKP Transponder Interface Software
HKP Enhanced Missile Barrage
"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion.
I watched C-beams glitter in the dark near Tannhäuser Gate. All those moments will be
lost in time, like tears in rain." - R. Batty
HKP Transponder Interface Software
HKP Enhanced Missile Barrage
-
- Posts: 2033
- Joined: Wed, 29. Jun 05, 01:45
-
- Posts: 99
- Joined: Thu, 28. Oct 04, 18:50
But this still requires the t-file to exist, so I will take my conclusion from that fact...s9ilent wrote:Yes, but you have to use the \033R type colour tags for non log book stuff.
e.g. <t id="1550">\033R%s\033X</t> <--- in your text file
then use.. sprintf from page from text id 1550, arg1 2 3 4 5

Space Cowboy - http://www.myspace.com/hardknight
"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion.
I watched C-beams glitter in the dark near Tannhäuser Gate. All those moments will be
lost in time, like tears in rain." - R. Batty
HKP Transponder Interface Software
HKP Enhanced Missile Barrage
"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion.
I watched C-beams glitter in the dark near Tannhäuser Gate. All those moments will be
lost in time, like tears in rain." - R. Batty
HKP Transponder Interface Software
HKP Enhanced Missile Barrage
-
- Posts: 99
- Joined: Thu, 28. Oct 04, 18:50
Quick question, is it possible to set the command upgrade requirements to more than one ware? For example, I want a command that is available only if Navigation AND Exploration software are BOTH installed on a ship.
Space Cowboy - http://www.myspace.com/hardknight
"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion.
I watched C-beams glitter in the dark near Tannhäuser Gate. All those moments will be
lost in time, like tears in rain." - R. Batty
HKP Transponder Interface Software
HKP Enhanced Missile Barrage
"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion.
I watched C-beams glitter in the dark near Tannhäuser Gate. All those moments will be
lost in time, like tears in rain." - R. Batty
HKP Transponder Interface Software
HKP Enhanced Missile Barrage
-
- Posts: 283
- Joined: Sun, 3. Aug 08, 20:30
Edited since it was incorrect..
Check out the big brain on Gazz.
Check out the big brain on Gazz.
Last edited by WindsOfBoreas on Tue, 11. Aug 09, 18:52, edited 1 time in total.
"Humanity has the stars in its future, and that future is too important to be lost under the burden of juvenile folly and ignorant superstition." - Isaac Asimov
-
- Posts: 13244
- Joined: Fri, 13. Jan 06, 16:39
These are not binary flags. They cannot be ORed just like banana ice cream cannot be ORed.
You probably need to use a check script.
Brother Maynard! Read us the passage about check scripts from the holy MSCI!
You probably need to use a check script.
Brother Maynard! Read us the passage about check scripts from the holy MSCI!
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.
There is no sense crying over every mistake. You just keep on trying till you run out of cake.
-
- Posts: 283
- Joined: Sun, 3. Aug 08, 20:30
-
- Posts: 2033
- Joined: Wed, 29. Jun 05, 01:45
Just one more thing about check scripts.
Whilst you can use return Com.disabled (I think that's what its called) to show that the command is un-selectable if its missing the second software piece, if you want it to not display at all, you have to return null
e.g. This will just not show the command at all if the ware is not present
e.g. This will show the command, but it will be grey'ed out
---------------------------------------------------
Q: One way gates
I'm just looking for some info on 1 way gates (I can't seem to find the info in the X3R/X2 stickies any more
). More specifically, what gate ID's do they use?
I was under the impression that they use -1, and that they link to a gate of any id. (Or may be I had it the other way around, they have id 0-6 and link to -1's.... orrrrr.. maybe I imagined it again?)
Whilst you can use return Com.disabled (I think that's what its called) to show that the command is un-selectable if its missing the second software piece, if you want it to not display at all, you have to return null
e.g. This will just not show the command at all if the ware is not present
Code: Select all
skip if $ship get amt of ware $ware
return null
return true
Code: Select all
skip if $ship get amt of ware $ware
return [Com.disabled]
return true
---------------------------------------------------
Q: One way gates
I'm just looking for some info on 1 way gates (I can't seem to find the info in the X3R/X2 stickies any more

I was under the impression that they use -1, and that they link to a gate of any id. (Or may be I had it the other way around, they have id 0-6 and link to -1's.... orrrrr.. maybe I imagined it again?)
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Thanks for the answer. That's how I did it. However I still find it odd, that the FLRET_INTERRUPTED even fired, because the ship was OOS and there was now ship around which could have caused that.Where as a normal script, when it is interrupted, it would stop at the next break point, do the interrupt task, then return to the break point; A fly command when interrupted, will just end and return the flret_interupted. So typically, when the flret_interupted is encountered, you just repeat the fly command (thou most scripts catch this exception with a if not xxxxx, rather then catching that exception specifically)
Well, however I have another problem:
I'm experiencing strange behaviour with SIGNAL_SELWARE (most probably also SIGNAL_BUYWARE).
I have connected the SIGNAL_SELWARE to a station -- let's say a cahoona fab.
When I now move the blue slider to buy something WITHOUT actually doing so, the signal fires.
Is this intended or am I doing something wrong?
Greets,
ScRaT
-
- Posts: 2033
- Joined: Wed, 29. Jun 05, 01:45
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Okay, my fault -- it was late yesterday. The signal works just fine!
Only fires, when something is really bought.
The arguments are:
* 1: ship , Var/Ship , 'trading partner'
* 2: ware , Var/Ware , 'ware'
* 3: amount , Var/Number , 'amount'
* 4: price , Var/Number , 'price'
There is also a fifths argument returning special wares, like marines.
Additionally it happened all OOS...
Greets,
ScRaT
Only fires, when something is really bought.
No, it's not. But remember, that when a station buys something, a ship is actually selling it.Wooot? Stations can use the signal too? I thought it was just for ships?
The arguments are:
* 1: ship , Var/Ship , 'trading partner'
* 2: ware , Var/Ware , 'ware'
* 3: amount , Var/Number , 'amount'
* 4: price , Var/Number , 'price'
There is also a fifths argument returning special wares, like marines.
No, as I said. In my whole testing universe, there is no other ship. The only thing that could be the reason is, that the ship was undocking before, but I left a wait of 1000 ms.It could be possible that other signals are firing (Attacked, leader needs help, leader jumping)
Additionally it happened all OOS...
Greets,
ScRaT
-
- Posts: 17
- Joined: Thu, 24. Nov 05, 23:21
What would cause the game to crash after the splash screen when loading a mod containing only one ship(body and scene files), a lang file, and a tships file?
This has really become quite a production to get a single ship working...hopefully the next one won't be so bad.
A copt of the .cat and .dat files are here...
http://www.mediafire.com/file/kzxlihozqgo/firstship.rar
...I have no idea what is wrong at this point, any ideas would be great.
Thanks.
This has really become quite a production to get a single ship working...hopefully the next one won't be so bad.
A copt of the .cat and .dat files are here...
http://www.mediafire.com/file/kzxlihozqgo/firstship.rar
...I have no idea what is wrong at this point, any ideas would be great.
Thanks.
-
- Posts: 1135
- Joined: Sun, 19. Oct 08, 18:46
If you are replacing a vanilla ship and you saved your game with one of those ships in the same sector as you, then it will crash on loading. Other than that I dunno.jay5965 wrote:What would cause the game to crash after the splash screen when loading a mod containing only one ship(body and scene files), a lang file, and a tships file?
This has really become quite a production to get a single ship working...hopefully the next one won't be so bad.
A copt of the .cat and .dat files are here...
http://www.mediafire.com/file/kzxlihozqgo/firstship.rar
...I have no idea what is wrong at this point, any ideas would be great.
Thanks.
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: 17
- Joined: Thu, 24. Nov 05, 23:21
It crashes when starting the game from the launcher...I havent been able to even attempt to start a new game. Also, I made a new tships entry for it, so it isnt replacing any vanilla ships.If you are replacing a vanilla ship and you saved your game with one of those ships in the same sector as you, then it will crash on loading. Other than that I dunno.
EDIT: I maganaged to get the ship into the game but textures do not display and the name is a readtext....
-
- Posts: 99
- Joined: Thu, 28. Oct 04, 18:50
So... I'm trying to spawn a new station in a sector, and it's acting weird.
a) No matter what x, y, z pos I use, it stays on the same spot in the sector (0,0,0), though targeting the new station will show its x, y, z as the ones I gave. Subsequently using a Set Position or Force Position script command has the same effect... changes the shown x, y, z but the station still sits on the same spot in the sector.
b) EDIT: Okay, I figured out this one...
Thanks!
EDIT AGAIN:
LOL Okay I figured the first one out too... was assuming x,y,z was in kilometers, but its in meters... heh. IGNORE POST THANKS!!
a) No matter what x, y, z pos I use, it stays on the same spot in the sector (0,0,0), though targeting the new station will show its x, y, z as the ones I gave. Subsequently using a Set Position or Force Position script command has the same effect... changes the shown x, y, z but the station still sits on the same spot in the sector.
b) EDIT: Okay, I figured out this one...
Thanks!
EDIT AGAIN:
LOL Okay I figured the first one out too... was assuming x,y,z was in kilometers, but its in meters... heh. IGNORE POST THANKS!!
Space Cowboy - http://www.myspace.com/hardknight
"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion.
I watched C-beams glitter in the dark near Tannhäuser Gate. All those moments will be
lost in time, like tears in rain." - R. Batty
HKP Transponder Interface Software
HKP Enhanced Missile Barrage
"I've seen things you people wouldn't believe. Attack ships on fire off the shoulder of Orion.
I watched C-beams glitter in the dark near Tannhäuser Gate. All those moments will be
lost in time, like tears in rain." - R. Batty
HKP Transponder Interface Software
HKP Enhanced Missile Barrage
-
- Posts: 2033
- Joined: Wed, 29. Jun 05, 01:45
Q: How Large is a sector? And what is the max distance you can travel across it i.e. sqrt (x sq + y sq + z sq) ?
Context:
For my path finding script I'm adding up all the distances traveled, and I'm just wondering whether or not there is a chance of integer overflow and whether or not I should use a maths lib?
i.e. is 480 * max dist < 2 bil?
i.e. is max dist < 4.166 million?
i.e. is single axis max dist < 2.4 mil?
(by single axis dist i mean -n to + n)
Q2: Is the following code valid?
(i.e. Will it go B, A, B, or will something funkier happen?)
Context:
label 1 is called when an object in question dies, it performs clean up (stuff_A), and then picks the next best object (with code stuff_B)
label 2 is called when I just need to pick the next best (with out any clean up)
Q3: Do text files need to be in order?
e.g. tid 10, 9 8 7 6, is still valid right? i.e. They don't need to be incremental
Q4: I don't suppose someone knows what this equals? 224|2 (not in x3, but in ... ... computing.. bit flags type thing. (binary mask?)
Context:
For my path finding script I'm adding up all the distances traveled, and I'm just wondering whether or not there is a chance of integer overflow and whether or not I should use a maths lib?
i.e. is 480 * max dist < 2 bil?
i.e. is max dist < 4.166 million?
i.e. is single axis max dist < 2.4 mil?
(by single axis dist i mean -n to + n)
Q2: Is the following code valid?
(i.e. Will it go B, A, B, or will something funkier happen?)
Code: Select all
gosub label2
gosub label1
return null
label1:
...stuff_A
label2:
...stuff_B
endsub
Context:
label 1 is called when an object in question dies, it performs clean up (stuff_A), and then picks the next best object (with code stuff_B)
label 2 is called when I just need to pick the next best (with out any clean up)
Q3: Do text files need to be in order?
e.g. tid 10, 9 8 7 6, is still valid right? i.e. They don't need to be incremental
Q4: I don't suppose someone knows what this equals? 224|2 (not in x3, but in ... ... computing.. bit flags type thing. (binary mask?)