0 votes
by (750 points)
edited by

I think this has been done before but I need some help with 'love' meter. I'm making a dating sim and the game starts with $Love set to 100. the range goes up to 500, and raises by 10-40 each time you successfully gain love and decreases upon a wrong choice.

So, when $Love is 100, texts appears under the meter that says "Stranger'. When you finally get $Love to 200, the text changes to "Friend'. Then at 300, changes to 'Boyfriend', at 400, the text changes to "Lover' and finally at 500, it displays "Engaged'.


I was able to make this 'work', but sometimes the old status will still show and the new one will show above it.


Example of working and the problem:


(one black line shows 1 status, the 2 lines are two statuses showing)


Sometimes they correctly, other times it shows both Status's


I just want to see how this is suppose to work without a variable being 140 and showing both the 100 and 200 status. I feel like this is a simple fix but i'm too scared to run my current script since it's 'working. The affected meter is :

<<if $Love lt 200>>\

<font color="blue">Status 1</font>


<<if $Love gte 200 and $Love isnot 100>>\

<font color="blue">Status 2</font>




It's odd this happens randomly. I know the color font is outdated but works for my needs.


I hope this makes sense and Thanks in advance!


1 Answer

+1 vote
by (159k points)

The following widget example shows how to do as wo asked, the code should be placed within a new Passage that you have assigned a widget tag to.

	<<lovestatus value>>

		value: The current value of love.

		<<lovestatus $love>>
<<widget "lovestatus">>
		<<set _love to $args[0]>>
		<<if _love gte 100 and _love lt 200>>
			<<set _status to "Status 1">>
		<<elseif _love gte 200 and _love lt 300>>
			<<set _status to "Status 2">>
		<<elseif _love gte 300 and _love lt 400>>
			<<set _status to "Status 3">>
		<<elseif _love gte 400 and _love lte 500>>
			<<set _status to "Status 4">>
			<<set _status to "Unknown">>

You will need to replace the current values assigned to the _status temporary variable with the actual ones you want.

You will notice that I have replaced your font element with some Custom Style markup, I did this because that element is now considered obsolete. The custom style markup I used relies on you adding CSS like the following to your project's Story Stylesheet area.

.love {
	color: blue;