It looks like you're new here. If you want to get involved, click one of these buttons!
<<widget "stats">>\ <<if $checkloginteacher is true>><<set $player.experience to $player.experience + 5>><</if>>\ <<if $checkopenteams is true>><<set $player.experience to $player.experience + 5>><</if>>\ <b>Experience: <<=$player.experience>> Rank:<<if $player.experience lt 20>> What is TEAMS? <<elseif $player.experience lt 40>> Novice <<elseif $player.experience lt 60>> I'm starting to get it <<elseif $player.experience lt 80>> Almost there <<elseif $player.experience lt 100>> Master TEAMS Player </b><</if>>\ <</widget>>
Comments
Now, on to your question.
First. Unless you already have a way to shake/shudder/rumble your text, you will probably want to download the <<shake>> macro set add-on from SugarCube 2's website (under: Downloads > Add-ons). Installation and usage instructions are included within the package.
Once you have a way to shake your text, how you might apply that when the player's experience changes depends on where/how you're using your <<stats>> widget. So, yeah, we're going to need some details.
I've downloaded and installed the <<shake>> macro. As far as the usage of the stats macro goes, I'm including it at the top of each passage to display the running experience points and rank of the player.
I can write an <<if>> conditional that checks $player.experience, but I'm not sure what operator to use, since I haven't found one for "increase value."
I did try to work <<shake>> into the macro by having it execute on $player.experience along with the existing <<if>>, but that only displayed $player.experience and shook it in front of the macro, not as a part of the macro:
I also thought I may be able to shake the value by just executing the macro around the <<if>> result:
Thanks so much for taking the time to answer these.
Also, based on your code, your closing bold tag should probably be outside of the rank <<if>>, rather than with the final <<elseif>>—I've done so in my example above.
I'm going to be adding quite a few additional variables other than $checkloginteacher and $checkopenteams, so to avoid having to enter all of them into the <<if>>, I'd like to find a way to say:
My concern here is that since usually, I award experience on the slide after something was done, the program won't see that the change was made until the third passage in a sequence. For example:
Passage 1:
Passage 2:
After the experience is calculated, the stats macro runs to display the total running exp so far. Since the experience is updated on the same passage, I'm worried that the <<shake>> wouldn't take effect until the next slide.
As an alternative, is there a way to calculate input on the same passage where it is input?I thought about trying to use postdisplay or postrender, but those are a bit above my skill level.
The shake will take effect as part of the invocation of <<stats>>, since that's where it's located.
As far as the ordering goes, passages are processed top down. As long as the call to <<stats>> happens after any experience modifications within the same passage, or prior to it, then the widget should be able to respond to them without issue.
Assuming you mean with a macro like <<textbox>>, then no. They weren't written with that in mind.