It looks like you're new here. If you want to get involved, click one of these buttons!
Stat Points: <<set $Skills to 150>><span id="skills">$Skills</span> Strength: \ <span id="stats-str-minus">\ <<button "-">> <<if $Str gt 20>> <<if $Str eq 150>> <<run $("#stats-str-plus button").prop("disabled", false);>> <</if>> <<set $Str -=2, $Skills +=2>> <<replace "#stats-str">>$Str<</replace>> <<replace "#skills">>$Skills<</replace>> <<if $Str eq 20>> <<run $("#stats-str-minus button").prop("disabled", true);>> <</if>> <</if>> <</button>> \ </span>\ <span id="stats-str">$Str</span> \ <span id="stats-str-plus">\ <<button "+">> <<if $Str lt 150 and $Skills gt 0>> <<if $Str eq 20>> <<run $("#stats-str-minus button").prop("disabled", false);>> <</if>> <<set $Str +=2, $Skills -=2>> <<replace "#stats-str">>$Str<</replace>> <<replace "#skills">>$Skills<</replace>> <<if $Str eq 150>> <<run $("#stats-str-plus button").prop("disabled", true);>> <</if>> <</if>> <</button>> </span>\ <<if $Str gt -100 and $Str lt 40>> <<set $S1 to true>> S1 TRUE <</if>> <<if $Str gte 40 and $Str lt 70>> <<set $S2 to true>> S2 TRUE <</if>> <<if $Str gte 70 and $Str lt 90>> <<set $S3 to true>> S3 TRUE <</if>> <<if $Str gte 90 and $Str lt 115>> <<set $S4 to true>> S4 TRUE <</if>> <<if $Str gte 115 and $Str lt 135>> <<set $S5 to true>> S5 <</if>> <<if $Str gte 135>> <<set $S6 to true>> S6 TRUE <</if>>
Comments
You might need a separate span-id and replace call to get the Sx value updated - the update can go in the gadget as well.
If so, and if that's all you're attempting to do, then you probably do not need the $S# variables at all. I'd suggest placing the tier messages for each stat in their own passages (e.g. Strength Tiers), then simply have the stat blocks replace the message display area with that passage. For example: Notice that at the tail of each stat block is a new element to hold the tier descriptions. Each tier description passage is displayed initially and then redisplayed each time the associated stat is changed.
Each tier description passage (e.g. Strength Tiers) would look something like the following:
Yes!! That worked perfectly, thank you mad exile! I wasn't aware that displaying different passages worked in that fashion? Makes me wonder why a single passage can't do that without needing to have that secondary passage involved to call upon.
Yea I was thinking about the necessity for a seperate span-id and whatnot. Unfortunately the macro wiki is fairly sparse on information about the variety of use for the span-id integer, and I generally found that people were using that sort of thing in Harlowe rather than sugarcube when I checked other questions regarding the <<replace>> macro and <<span-id>>. Makes me wonder if I'm using the right story format x)
I assume you're referring to the problem TheMadExile had answered by the way and not the idea whereby stat values are replaced on the go in this system? Because that sounds like it would be more trouble than it's worth right now in all honesty x)
Yes, I found that out briefly after posting that last message! It's always good to learn new things such as these :')
Crikey I wouldn't have even realised! Also, I have noticed that sometimes *would-be-code* can sometimes create a large chasm between written dialogue/paragraphs of text.
Is this normal or abnormal - if so, is there a way to minimise that? I believe it would assist in the immersion of the player into the game-world.
eg. The following passage code: ... appears with a blank line between the second and third lines of text: ... because of the line-break after the <</if>> end macro.
There are a couple of ways to remove unwanted line-breaks:
1. Using a backslash as explained in the Line Continuations section of the manual. Note the backslash added after the <</if>> macro: 2. Use the <<nobr>> macro or the nobr special tag.
3. Remove the line-break(s):
Ahh. Much obliged greyelf, only just seen this