why i cant change all of the <speak>..?

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Honest-DS
Posts: 4
Joined: Sun, 21. May 23, 04:37

why i cant change all of the <speak>..?

Post by Honest-DS »

i just try these:
add a show_help to every <speak>

now,i want to test it,use <remove> to remove every speak
this is my file:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<remove sel="//speak[1]"/>
<remove sel="//speak[2]"/>
<remove sel="//speak[3]"/>
<remove sel="//speak[4]"/>
<remove sel="//speak[5]"/>
<remove sel="//speak[6]"/>
<remove sel="//speak[7]"/>
<remove sel="//speak[8]"/>
<remove sel="//speak[9]"/>
<remove sel="//speak[10]"/>
<remove sel="//speak[11]"/>
<remove sel="//speak[12]"/>
<remove sel="//speak[13]"/>
<remove sel="//speak[14]"/>
</diff>
like this,i just write to [668]

but it not work..nothing happened...
User avatar
Dj_FRedy
Posts: 245
Joined: Mon, 27. Jun 11, 05:58
x4

Re: why i cant change all of the <speak>..?

Post by Dj_FRedy »

Try it like this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
    <remove sel="(//speak)[1]"/>
</diff>
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".
Thank you for your efforts.
Honest-DS
Posts: 4
Joined: Sun, 21. May 23, 04:37

Re: why i cant change all of the <speak>..?

Post by Honest-DS »

Dj_FRedy wrote: Sun, 21. May 23, 09:56 Try it like this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
    <remove sel="(//speak)[1]"/>
</diff>
thx a lot....i see this way is wrong...
so,i find a another method...
change the signal of the speak..like this

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<mdscript name="Talk_test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
	<cues>
		<cue name="talk_start_story" instantiate="true">
			<conditions>	
				<check_all>			
					<event_cue_signalled cue="md.NPC_UseCases.UseCase.Speak" />
				</check_all>
			</conditions>
			<actions>
				<remove_help all="true"/>
    			<show_help name="show_start" custom="'test'" duration="10s" silent="true" force="true" position="20" width="1000"/>
			</actions>
		</cue>
	</cues>
</mdscript>
this route should be correct...but debug still show this:Property lookup failed: md.NPC_UseCases.UseCase.Speak
User avatar
Dj_FRedy
Posts: 245
Joined: Mon, 27. Jun 11, 05:58
x4

Re: why i cant change all of the <speak>..?

Post by Dj_FRedy »

Ok, I've been looking at this a bit. There is a library that is called every time by 'include_actions': DoSpeak
Patch this library in 'NPC_UseCases' for 'show_help'.
something dirty for testing ...

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
    <add sel="//library[@name='DoSpeak']/actions/do_if">
        <set_value name="$is_numeric_page" exact="(typeof Speak.$page).isnumeric"/>
        <set_value name="$is_numeric_line" exact="(typeof Speak.$linewithdelay).isnumeric"/>
        <debug_text text="'is_numeric_page: ' + $is_numeric_page + ', is_numeric_line: ' + $is_numeric_line" chance="100"/>

        <set_value name="$speakpage" exact="null"/>
        <do_if value="$is_numeric_page">
            <set_value name="$speakpage" exact="Speak.$page"/>
        </do_if>

        <set_value name="$speakline" exact="null"/>
        <do_if value="$is_numeric_line">
            <set_value name="$speakline" exact="Speak.$linewithdelay"/>
        </do_if>
        <!-- in case of being stored in a list: exact="[ $ScriptEntry.$speakdelay, Speak.$line ]" -->
        <do_elseif value="(typeof Speak.$linewithdelay.{2}).isnumeric">
            <set_value name="$speakline" exact="Speak.$linewithdelay.{2}"/>
        </do_elseif>

        <do_if value="($speakpage != null) and ($speakline != null)">
            <remove_help all="true"/>
            <set_value name="$stringtext" exact="readtext.{$speakpage}.{$speakline}"/>

            <debug_text text="'speakpage: ' + $speakpage + ', speakline: ' + $speakline + ', stringtext: ' + $stringtext" chance="100"/>
            <show_help name="show_start" custom="$stringtext" duration="10s" silent="true" force="true" position="20" width="1000"/>
        </do_if>
    </add>
</diff>
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".
Thank you for your efforts.
Honest-DS
Posts: 4
Joined: Sun, 21. May 23, 04:37

Re: why i cant change all of the <speak>..?

Post by Honest-DS »

Dj_FRedy wrote: Sun, 21. May 23, 16:23 Ok, I've been looking at this a bit. There is a library that is called every time by 'include_actions': DoSpeak
Patch this library in 'NPC_UseCases' for 'show_help'.
something dirty for testing ...

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
    <add sel="//library[@name='DoSpeak']/actions/do_if">
        <set_value name="$is_numeric_page" exact="(typeof Speak.$page).isnumeric"/>
        <set_value name="$is_numeric_line" exact="(typeof Speak.$linewithdelay).isnumeric"/>
        <debug_text text="'is_numeric_page: ' + $is_numeric_page + ', is_numeric_line: ' + $is_numeric_line" chance="100"/>

        <set_value name="$speakpage" exact="null"/>
        <do_if value="$is_numeric_page">
            <set_value name="$speakpage" exact="Speak.$page"/>
        </do_if>

        <set_value name="$speakline" exact="null"/>
        <do_if value="$is_numeric_line">
            <set_value name="$speakline" exact="Speak.$linewithdelay"/>
        </do_if>
        <!-- in case of being stored in a list: exact="[ $ScriptEntry.$speakdelay, Speak.$line ]" -->
        <do_elseif value="(typeof Speak.$linewithdelay.{2}).isnumeric">
            <set_value name="$speakline" exact="Speak.$linewithdelay.{2}"/>
        </do_elseif>

        <do_if value="($speakpage != null) and ($speakline != null)">
            <remove_help all="true"/>
            <set_value name="$stringtext" exact="readtext.{$speakpage}.{$speakline}"/>

            <debug_text text="'speakpage: ' + $speakpage + ', speakline: ' + $speakline + ', stringtext: ' + $stringtext" chance="100"/>
            <show_help name="show_start" custom="$stringtext" duration="10s" silent="true" force="true" position="20" width="1000"/>
        </do_if>
    </add>
</diff>
thx~~but after i fix it like this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
    <add sel="//library[@name='DoSpeak']/actions/do_if/speak" pos="before">
        <debug_text text="showing"/>
        <show_help name="show_start" custom="test" duration="10s" silent="true" force="true" position="20" width="1000"/>
    </add>
</diff>
but it still cant show at Bostar say something....

but i write another mdscript to fix this:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<mdscript name="Talk_test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
	<cues>
		<cue name="talk_start_story" instantiate="true" checkinterval="50ms">
			<actions>
				<do_if value="player.speakpriority > -1000">
					<show_help name="show_start" custom="'test'" duration="5256000min" silent="true" force="true" position="20" width="1000"/>
				</do_if>
				<do_if value="player.speakpriority == -1000">
					<remove_help all="true"/>
				</do_if>
			</actions>
		</cue>
	</cues>
</mdscript>
it will could be use some system resource...and some background sound could not work..
but its a big step~
User avatar
Dj_FRedy
Posts: 245
Joined: Mon, 27. Jun 11, 05:58
x4

Re: why i cant change all of the <speak>..?

Post by Dj_FRedy »

Sorry, now I'm lost, you're going to have to explain in more detail what you intend to do.
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".
Thank you for your efforts.
Honest-DS
Posts: 4
Joined: Sun, 21. May 23, 04:37

Re: why i cant change all of the <speak>..?

Post by Honest-DS »

Dj_FRedy wrote: Sun, 21. May 23, 17:55 Sorry, now I'm lost, you're going to have to explain in more detail what you intend to do.
No more :wink: ..I have already completed it~thx~
https://media.discordapp.net/attachment ... /image.png
Last edited by Terre on Sun, 21. May 23, 19:48, edited 1 time in total.
Reason: Images posted directly to the forums should not be greater than 640x480 or 100kb, oversize image now linked
User avatar
Dj_FRedy
Posts: 245
Joined: Mon, 27. Jun 11, 05:58
x4

Re: why i cant change all of the <speak>..?

Post by Dj_FRedy »

Hey, well nothing, I'm glad.
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".
Thank you for your efforts.

Return to “X4: Foundations - Scripts and Modding”