Forum Announcement, Click Here to Read More From EA_Cade.

How do you activate templates based on whether a state is active?

ItsProbablyMeItsProbablyMe Posts: 17 Member
I am creating a mod for the "More Views Video Station". The mod adds an addon called clickbait which when bought adds default video titles and descriptions for the different mods you can create.

So far I have set up the addon and you can buy it. Currently, I am working on adding default video names and descriptions when the addon bought state is active. I can do it when it is not active like so:
<V n="name" t="enabled">
    <U n="enabled">
        <V n="affordance" t="enabled">
          <T n="enabled">192637<!--rename_VideoRecording--></T>
        </V>
        <T n="allow_description">True</T>
		<L n="templates">
          <U>
            <T n="template_description">0x47E1CCBE<!--This is a Nonfiction book.--></T>
            <T n="template_name">0xE4B5FB41<!--Life of i: Imaginary Numbers and You--></T>
          </U>
          <U>
            <T n="template_description">0x47E1CCBE<!--This is a Nonfiction book.--></T>
            <T n="template_name">0x85D6CEC6<!--The Fox of Park Avenue--></T>
          </U>
          <U>
            <T n="template_description">0x47E1CCBE<!--This is a Nonfiction book.--></T>
            <T n="template_name">0xD26D8C1<!--Lies My Writing Teacher Told Me--></T>
          </U>
          <U>
            <T n="template_description">0x47E1CCBE<!--This is a Nonfiction book.--></T>
            <T n="template_name">0xEFE6DCF<!--Heroes of SimCity: Candid Portraits and Tales--></T>
          </U>
        </L>
      </U>
</V>

This will randomly select one of the above templates as the initial text when you record a beauty tips video but I tried to use a test based outcome to activate these templates when the correct state was active and it did not work:
 <V n="name" t="enabled">
      <U n="enabled">
        <V n="affordance" t="enabled">
          <T n="enabled">192637<!--rename_VideoRecording--></T>
        </V>
        <T n="allow_description">True</T>
		<V n="outcome" t="test_based">
		  <U n="test_based">
		    <L n="tested_outcomes">
		      <U>
		        <L n="potential_outcomes">
		          <U>
		            <U n="outcome">
		              <L n="templates">
				<U>
				    <T n="template_description">0x47E1CCBE<!--This is a Nonfiction book.--></T>
				    <T n="template_name">0xE4B5FB41<!--Life of i: Imaginary Numbers and You--></T>
				</U>
				<U>
				    <T n="template_description">0x47E1CCBE<!--This is a Nonfiction book.--></T>
				    <T n="template_name">0x85D6CEC6<!--The Fox of Park Avenue--></T>
				</U>
				<U>
				    <T n="template_description">0x47E1CCBE<!--This is a Nonfiction book.--></T>
				    <T n="template_name">0xD26D8C1<!--Lies My Writing Teacher Told Me--></T>
				</U>
				<U>
				    <T n="template_description">0x47E1CCBE<!--This is a Nonfiction book.--></T>
				    <T n="template_name">0xEFE6DCF<!--Heroes of SimCity: Candid Portraits and Tales--></T>
				</U>
				</L>
		            </U>
		          </U>
		        </L>
		        <L n="tests">
		          <L>
		            <V t="state">
		              <U n="state">
		                <T n="value">5887582488641372904<!--itsprobablyme_videoStation_GeoState_NoLightsNoCameraClickbait--></T>
		              </U>
		            </V>
		          </L>
		        </L>
		      </U>
		    </L>
		  </U>
		</V>
      </U>
    </V>

The code was added to the object_videorecording_tips_beauty file.

Another problem I'll have to overcome is I have many possible states that are active when my addon is bought I am currently testing it with No Lights or Camera purchased but clickbait is purchased:
<T n="value">5887582488641372904<!--itsprobablyme_videoStation_GeoState_NoLightsNoCameraClickbait--></T>

How would I make it so any of my states would activate the templates it like an or switch.

Thank you very much for any help! This is my first mod so please bear with me as everything is a struggle right now xd

Edit: Please also note that the templates are currently referring to non-fiction books when it is, in fact, beauty videos because I ripped it from the write book functionality and it is a placeholder at the moment. Thanks!

Comments

  • ItsProbablyMeItsProbablyMe Posts: 17 Member
    Anyone, know? I am basically just looking for how to do a conditional in the xml.

    e.g. If a state is active where you have bought my custom add on then activate templates for video names and descriptions else use default.
Sign In or Register to comment.
Return to top