[Discussion] Generic X3TC S&M questions II

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

h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

drop the km, 1000km is much too large.
in MD: the sector size averages around 35km

Since you are creating missions that you wanted triggered via SE, I'd love to show you how to do it with MD Control.
I'm looking for a willing test subject to use and let me put on display as an example for. :)
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

But I need somewhere to hide ships... can I use null?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

I use kuiper belt
x="-100000" y="0" z="0"

:P

or Aldrin... that place is just too big
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Hm... can you place stuff inside the asteroid?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

nope, but you could hide them inside MD Controls hidden control sector.

*this post ooozes with blatant self-promotion*
8)
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Still having problems finding something at set coords... it's just finding anything randomly in the sector at the moment. -.-
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
Ketraar
EGOSOFT
EGOSOFT
Posts: 12187
Joined: Fri, 21. May 04, 17:15
x4

Post by Ketraar »

Code: Select all

<find_ship name="this.triggership">
                <position x="1000km" y="1000km" z="1000km" exact="0"/>
                <sector x="0" y="0"/>
              </find_ship>
dont use exact=0, this kinda limits the search, use min=0 max 20km instead (20km radius from that position).

MFG

Ketraar
Image
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

nevermind..

MD crashes if you use set_value in the top cue.
Moving set_value to the first child cue prevented MD from crashing.
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

Anyone know how notoriety loss is tied to sig.attacked and sig.killed?
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

No idea. :(



Anyone know what the limits are for adding ships to stations? The script in the galaxy editor happily adds ships for sale to equipment docks and the like, but doesn't seem to work when I do it manually in game.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

might be MD only.
SRM uses the MD to add ships to shipyards.

Which gives me the idea that MD Control needs to pass strings asap so that SE can tell MD which ships to add/remove etc..
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Few quick menu questions because I forgot how to do them... :roll:


How do you make it go back to a menu after doing something else? Forgot.


How do you make a menu which refreshes constanly (or at least every few seconds). Always wanted to know.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

How do you make it go back to a menu after doing something else? Forgot.
You go back the point, where you created the old menu?!
I always do it like this:

Code: Select all

MainMenu:

$menu = create new menu...
* Fill menu with stuff
$ret = open menu: $menu
if $ret == 'Something'
  $submenu = create new menu...
  * Fill submenu
  $ret == open menu: $submenu
  if $ret == -1
    goto label MainMenu
  end
end
How do you make a menu which refreshes constanly (or at least every few seconds). Always wanted to know.
Have a look at my tutorial. ;)

Greetings,
ScRaT
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

REMOVED. :roll:
Last edited by EmperorJon on Sat, 11. Dec 10, 22:10, edited 1 time in total.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Ah, thanks!


Now I just need to read up a bit on butchering strings.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
h2o.Ava
Posts: 349
Joined: Sun, 12. Oct 08, 04:04
x4

Post by h2o.Ava »

when converting a number to string it will add commas ","

10000 becomes 10,000
5 positions become 6
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

That might be useful!


Ok, let's assume I've got a nice long string of stuff. Seperated, in this case, by ;;.

How would I find each section...?

There's several, all seperated by ;;... some is string, some are numbers.


How would I pull the whole lot apart!?
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

You could use a premade library, like this one (see 1. split.string.by.delim).
Or you could write yourself your own library, which is not that hard.

This is what I use:

Code: Select all

010   $array =  array alloc: size=0
011   
012   skip if $delim
013   |$delim = ','
014   
015   * find first element
016   $position =  find position of pattern $delim in $string
017   
018   skip if $position >= 0
019   |$position =  get length of string $string
020   
021   while $position > 0
022   |$element =  get substring of $string offset=0 length=$position
023   |$length =  get length of string $element
024   |
025   |append $element to array $array
026   |
027   * slice string, only using the part after the current element
028   |$length =  get length of string $string
029   |$length = $length - $position
030   |inc $position = 
031   |$string =  get substring of $string offset=$position length=$length
032   |
033   * find next position
034   |$position =  find position of pattern $delim in $string
035   |
036   |skip if $position >= 0
037   ||$position =  get length of string $string
038   |
039 @ |= wait 1 ms
040   end
041   
042   return $array
Interestingly, I just saw that my code doesn't work with delimeters longer than 1 character (see line 31). :D
I guess I'll have to correct that.

Greetings,
ScRaT
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Well in this case the delimeters are 2 long... :S


EDIT: Length +/- 1 - the position...? Hmmm.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

EDIT: Length +/- 1 - the position...? Hmmm.
Simply replace line 30 with:
$lengthDelim = get length of string $delim
$position = $position + $lengthDelim

This should be enough. Don't have the time to test it right now though.

Greetings,
ScRaT

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