Is it possible to check whether a specific ship name contains a certain text?
I'd like to find all ships with name starting with [WING1].
Not familiar what kind of string operations X:RB implements...
Thanks!
Modding question
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 478
- Joined: Sun, 25. May 14, 17:45
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
with a workaround of abusing substitute_text yes, but thats the only supproted one. locating the position of a sub-string is sadly missing as i noticed lately.
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: 478
- Joined: Sun, 25. May 14, 17:45
<substitute_text> only replaces matched texts with a specified one, not sure how to recognize patterns with this.
I need function to see whether a certain sub-string is contained in the original text which will be part of a condition/filter.
My exact use case is:
"Find all the player ships in zone with [WING2] in their names."
I'm thinking about wing management through naming the ships.
Could we request the addition of such atomic function?
I need function to see whether a certain sub-string is contained in the original text which will be part of a condition/filter.
My exact use case is:
"Find all the player ships in zone with [WING2] in their names."
I'm thinking about wing management through naming the ships.
Could we request the addition of such atomic function?
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
well, as i said its a non-obvious workaround:
<substitute_text text="$check" source="$name">
<replace text="'[Wing1]'" with="''"/>
</substitute_text>
<do_if value="$check != $name"/>
..........
i would also need such functions for my Name Managment Script Project, but currently they are neither in ai/md nor in lua
EDIT: Corrected code (was on typing on originally)
<substitute_text text="$check" source="$name">
<replace text="'[Wing1]'" with="''"/>
</substitute_text>
<do_if value="$check != $name"/>
..........
i would also need such functions for my Name Managment Script Project, but currently they are neither in ai/md nor in lua
EDIT: Corrected code (was on typing on originally)
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
