Question about multireplace

Okay so for some reason I’m having large problem understanding the multireplace. I know how to use it for a basic trick I use in my game, but I wanting to expand it a little.

Currently, you have the option to cheat and see which option gives you a stat increase, or a perk.

For example, @{easy Empathy increased|} to show you’re empathy has increased for making a specific choice

I want to see if it’s possible to show an increase or decrease on the same choice.

Say you have a choice that needs an empathy check to pass or fail.

So, if you don’t pass that empathy check it would say Relationship Decrease, but if you went through another playthrough and passed the check, it would say Relationship Increase instead.

Sorry if I’m being dumb but I’m just having the hardest time figuring out this function.

If empathy was the name of your variable:

@{(empathy>50) Relationship Increase|Relationship Decrease}

Should work

Doesn’t quite work. I have another variable to make it show up altogether, (the ‘easy’ in the first post), so players can turn it on or off.

Assuming you’re using random roll to check your stat passing or not

*rand roll 1 2
*if roll = 1
   *set relationship -100
   @{easy Relationship decreased|}
*else
   *set relationship +100
   @{easy Relationship increased|}

Another form you can try

*rand roll 1 2
*set text ""
*if roll = 1
   *set relationship -100
   *set text "increased"
*else
   *set relationship +100
   *set text "decreased"

@{easy Notification: Relationship ${text}|}

Okay… so you only want this to show up in easy?
Before or after the choice is made?
Cause this method comes to mind:

*choice
   #option @{easy 1 (requires at least 46 empathy)| 1}
      *if (easy)
         Relationship @{(emp >=46) increased| decreased}
         *if (emp >=46)
            *set rel %+10
            *goto x
         *else
            *set rel %-10
            *goto x
      *else
         *if (emp >=46)
            *set rel %+10
            *goto x
         *else
            *set rel %-10
            *goto x

EDIT: alternatively:

*choice
   #option @{easy 1 (requires at least 46 empathy)| 1}
      *if (emp >=46)
         *set rel %+10
         *goto x
      *else
         *set rel %-10
         *goto x

*label x
*if (easy)
   [b]Relationship @{(emp >=46) increased| decreased}[/b]
   *line_break
Regular text

that what you meant? (assuming it goes to the same label afterwards)

I think what you’re asking for is stacking multireplace, or including multireplace options within multireplace.

Unfortunately you can’t do that.

Here’s how you might do it instead, assuming you’re testing Strength and changing your Empathy stat based on the result:

*if (Strength < 50)
  *set Empathy %-20
  @{easy Empathy decreased.|}
*if (Strength >= 50)
  *set Empathy %+20
  @{easy Empathy increased.|}

Unfortunately there’s not really a more elegant way to do it … unless!

Have a subroutine for checking a stat and changing another stat (which includes your multireplace for easy mode), and include parameters.

*gosub_scene subroutines stat_check "Strength" 50 "Empathy" 20

...

*label stat_check
*params

*if (${param_1} < ${param_2})
  *set ${param_3} %-${param_4}
  @{easy ${param_3} decreased.|}
*if (${param_1} >= ${param_2})
  *set ${param_3} %+${param_4}
  @{easy ${param_3} increased.|}

*return

Have NOT tested that AT ALL but give it a shot to see if it works.

1 Like

I’d recommend putting this in a subroutine. You can do it fairly easily like this. First, we need our stat to be changed, and a variable to control the announcement:

*temp empathy 50
*temp charisma 50
*temp announce_stat_changes true

Next we need our subroutine(s). (You can do it in one, and as an advance measure I’d recommend doing it as one, but I’ll show it as two to make it easier to follow.)

*label stat_raise
*params stat value
*set {stat} %+ value
*if announce_stat_changes
    $!{stat} increased.
*return

*label stat_drop
*params stat value
*set {stat} %- value
*if announce_stat_changes
    $!{stat} decreased.
*return

Then finally, rather than running *set like usual to change our stats, we instead run:

*gosub stat_raise "empathy" 10
*gosub stat_drop "charisma" 10

So a few comments here. First, I presumed the use of fairmath, but you can obviously tweak and change to suit your needs.

The second comment is that you have to pay attention to how we used a {reference} to change the real variable’s value, When we call the subroutine we pass it the variable name as a string, which is what lets us be able to both change the value of the variable, and display the name of the variable, but either using a {reference} or not as required.

The third note is that, since we pass the subroutine the variable’s name as a string, it currently will display it as is, meaning a one word variable (empathy) looks good: “Empathy Increased”, but a multiword variable name (jamie_relationship) looks bad: “Jamie_relationship Increased”.

That all said, here’s the massive subroutine I use to do just this (note that it requires implicit_control_flow).

Code Block
*label stat_bump
*comment Required variables: announce(false) [Can be changed in param_5] log(false) [Can be changed in param_6 only if not using logging]
*comment Best practices: Never use in a direct quote. Use at the end of sentences for short announcements, or at the end of paragraphs for long announcements or announcements of indeterminate length. Use appended to paragraphs, as it has its own paragraph breaks where necessary (i.e. it should not have a *line_break or paragraph break before it).
*params s x
*comment param_1 s:("variable"(numeric)) Stat: Input is either stat, or opposed pair (setup below)
*comment param_2 x:(numeric) Amount of change
*if x <= 0
	*bug Stat change must be positive. Set parameter three to true to decrease stat.
*if param_count >= 3
	*temp m param_3
*else
	*temp m false
*comment param_3 m:(boolean) Minus: subtract rather than add. (optional: defaults to false)
*if param_count >= 4
	*temp f param_4
*else
	*temp f true
*comment param_4 f:(boolean) Fairmath: Use fairmath rather than plain addition/subtraction. (optional: defaults to true)
*if param_count >= 5
	*temp a param_5
*else
	*temp a announce
*comment param_5 a:(string|boolean) Announce: What announcement method to use (invalid = false). (optional: defaults to announce variable)
*comment           Valid string parameters are "long" (aka "l"); "short" (aka "s"); "shortdesc" (aka "sd", true)
*if param_count >= 6
	*temp l param_6
*else
	*temp l log
*comment param_6 l:(false|string) Log: Stat is part of a log chain if not false. (optional: defaults to log(which should default to false))
*comment           Valid string parameters are "open" (aka "o"); "body" (aka "b"); "close" (aka "c"); all other parameters are false
*temp r s
*temp o false
*comment r:report stat/variable; o:opposed(second of an opposed pair); y:amount of change
*if (m = "+") or (m = "%+")
	*set m false
*if (m = "-") or (m = "%-")
	*set m true
*if a = "l"
	*set a "long"
*if a = "s"
	*set a "short"
*if (a = true) or (a = "sd")
	*set a "shortdesc"
*if (l = "o")
	*set l "open"
*if l = "b"
	*set l "body"
*if (l = "c")
	*set l "close"
*if (l != "open") and ((l != "body") and (l != "close"))
	*set l false
*comment fixes and aka above
*if s = "mature"
	*set s "cute"
*if s = "honesty"
	*set s "charm"
*if s = "retro"
	*set s "modern"
*comment set opposed pairs above, where *if s = "non_variable"; then *set s "variable"
*if r != s
	*set o true
*comment sets opposed_pair true if report stat is different from stat to be used above.
*if r = "julia_like"
	*set r "Julia Like"
*if r = "julia_love"
	*set r "Julia Love"
*if r = "isiah_like"
	*set r "Isiah Like"
*if r = "isiah_love"
	*set r "Isiah Love"
*if r = "sam_like"
	*set r "Sam Like"
*if r = "sam_love"
	*set r "Sam Love"
*if r = "julia_isiah"
	*set r "Julia & Isiah"
*if r = "isiah_sam"
	*set r "Isiah & Sam"
*if r = "sam_isiah"
	*set r "Sam & Isiah"
*if r = "zoey_relationship"
	*set r "Zoey Like"
*if r = "sophia_relationship"
	*set r "Sophia Like"
*if r = "tristan_sophia_relationship"
	*set r "Tristan & Sophia"
*if r = "vivian_relationship"
	*set r "Vivian's Relationships"
*if r = "bonnie_relationship"
	*set r "Bonnie Like"
*if r = "moonlight_development"
	*set r "Moonlight Development"
*if r = "art_exhibit"
	*set r "Art Exhibit"
*if r = "game_development"
	*set r "Game Development"
*comment set display names above, where *if r = "variable_name"; then *set r "stat name"
*temp y {s}
*if not(f)
	*if (o or m) and not(o and m)
		*set {s} - x
		*set y - {s}
	*else
		*set {s} + x
		*set y ({s} - y)
*else
	*if (o or m) and not(o and m)
		*set {s} %- x
		*set y - {s}
	*else
		*set {s} %+ x
		*set y ({s} - y)
*if ((y > 5) and (a = "short")) and (l = false)
	*comment "shortdesc" overrides "short" if amount of change is > 5, and not part of a log. Comment out the below line to turn off.
	*set a "shortdesc"
*if (y = 0) and (a = "shortdesc")
	*comment "short" overrides "shortdesc" if variable was not actually changed due to fairmath.
	*set a "short"
*if a = "long"
	*if (l = false) or (l = "open")
		${""}

	*elseif (l = "body") or (l = "close")
		*line_break
	*else
		${""}
	*if y = 0
		[i]$!{r} is too @{m low|high} to @{m decrease|increase} further.[/i]
	*else
		[i]$!{r} @{m decreased|increased} by ${y} to @{o ${100-{s}}|${{s}}}.[/i]
	*if (l = false) or (l = "close")
		${""}

	*else
		${""}
*elseif a = "short"
	*set r "$!{r}"
	*if y = 0
		*set r r&" too @{m low|high} to @{m decrease|increase}"
	*label stat_bump_short_loop
	*if y <= 0
		*if (l = false) or (l = "open")
			*set r "["&r
		*if (l = false) or (l = "close")
			*set r r&"]"
		*if (l = "open") or (l = "body")
			*set r r&","
		[i]${r}[/i]
		*goto stat_bump_short_loop_exit
	*set r "@{m -|+}"&r
	*set y - 1
	*goto stat_bump_short_loop
*elseif a = "shortdesc"
	*if (l = false) or (l = "open")
		[i][@{m -|+}${y}
	*else
		@{m -|+}${y}
	*if (l = "open") or (l = "body")
		$!{r},
	*else
		$!{r}][/i]
*elseif a = false
	*goto stat_bump_short_loop_exit
*else
	*bug Invalid parameter: Announcement variable is ${a}. Acceptable values are "long", "short", or "shortdesc", or the booleans true or false.
*label stat_bump_short_loop_exit
*if l = "open"
	*set log "body"
*if l = "close"
	*set log false
*return
5 Likes