blueorc wrote:Hello everyone! I made a post a little while ago. Someone gave me a reply with an example included. That example helped a LOT! I have read the Squiffy Documentation several times, but for some reason the information doesn't get absorbed and I have difficulty understanding some things.
As a result I have a few more questions! It would be super awesome if you (who responds) could post an example that I could copy and paste into Squiffy and practice with.
1) If I wanted to include some type of HP system (using attributes) and I wanted X/Y/Z to happen based on the range of HP, how do I accomplish this? For example:
If the player's HP is between 3 and 10, go to X section. If the player's HP is 3 or less, go to Y section.
1a) How do I set up a type of 'damage' system? For example:
. . . .
@set gender = male
{if str = 10:text}
@start getSack
[[getSack]]:
@set str = 14
@set sackFull
@clear
You wake up. There is a big leather sack here. It may be <b>The</b> sack of gold! You could try to [take the sack](takeIt).
[takeIt]:
{if sackFull:
{if str>12:{strong}} {else:{weak}}
}
<!-- ** If the sack is *not* full ** -->
{else:
{if str<6:The sack isn't full, but you're still too weak to lift it.}
{else:The sack isn't full, so you are able to take it.}
}
[strong]:
You are strong enough to lift the huge sack of gold.
[weak]:
The sack is so full of gold that you can't lift it. You [collapse] from the effort.
[collapse]:
When you wake up, you are determined to build your strength before [[attempting to steal the sack]](getSack) of gold again.
Dennis Carlyle wrote: Yes, you can also use >, <, >=, <=. But ... and this may also be causing confusion ... you cannot (unless I'm missing something / screwing up) ... cannot include spaces between the variable and the operator of a Squiffy "if". So, setting a variable like this ...
@set gender = male
... is fine. But testing a variable, like this ...
{if str = 10:text}
... will not work.
So, at least as it stands now, "if str=10 ..." is the form I use as 'reliable'.
@start first
[[first]]:
@set x = 6
[[Begin.]](MainPassage)
[[MainPassage]]:
Your score is {x}.
[[Increase score by 2.]](IncreaseScore)
[[Decrease score by 2.]](DecreaseScore)
{if x<4:[[Go somewhere else.]](Low)}
{if x>=4:{if x<=10:[[Go somewhere else.]](Medium) }}
{if x>10:[[Go somewhere else.]](High)}
[[IncreaseScore]]:
@inc x 2
Your score has increased by 2.
[[Go back.]](MainPassage)
[[DecreaseScore]]:
@dec x 2
Your score has decreased by 2.
[[Go back.]](MainPassage)
[[Low]]:
Since your score is under 4, you are in the Low Score Zone.
[[Go back.]](MainPassage)
[[Medium]]:
Since your score is from 4-10, you are in the Medium Score Zone.
[[Go back.]](MainPassage)
[[High]]:
Since your score is over 10, you are in the High Score Zone.
[[Go back.]](MainPassage)
works for the medium and high score ranges, but not for the low score range. I don't know why.
bgbg wrote:Ok. I've reported an issue on Github and linked to this discussion.
(And thanks for the nudge to try JavaScript, even if it wasn't directed at me. I tried it and it wasn't as hard as I expected.)