Lots of Questions!

blueorc
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:

If players "Damage" attribute is 5, how would I turn that into a way to lowering the enemy_HP attribute?

1b) Once the enemy's HP is 0, how do I re-route to a new section?

1c) Does this system use negative numbers (10 damage subtracting from 5 HP attribute, is that -5 or 0?) and if it does work into negatives, how does that play into previous questions?


2) Is it possible to include 'random' text? I want it to appear without the 'player' having control over it in any way. Example:

"Hello my name is (Susan/Jill/Kelly)"


3) Is it possible to add pictures, sound, or edit the text in any way (Bold, italics, center the text, etc)?


4) In my previous post someone helped me with "If not seen", does this same system apply to "If seen" ? Example:

If a certain section (that 'contains' an item) has been seen, it allows the player to open a door.

5) Can you have multiple requirements for the 'seen'? Such as a story that has a bounty board, unlocking new choices once X/Y/Z sections have been passed/reached/seen (rather than through sections). The example given eliminated choices from a list, I'm thinking of adding choices in this idea.

bgbg
1) I don't know if you can use, for instance, > and < to compare values using Squiffy-specific code. I tried it out and was not able to get it to work right. It's possible to use JavaScript within Squiffy, though, and I assume it's possible to compare values in Javascript. I don't know JavaScript though so I can't help you with that.

2) Randomness: viewtopic.php?f=24&t=5572

3) Pictures/sound/text formatting: These types of things can be done using Markdown, HTML, and CSS. For example, using Markdown, putting **Two asterisks** before and after something will make it bold.

Centering text: viewtopic.php?f=24&t=6008
Sound: viewtopic.php?f=24&t=5623&p=41595
Images: viewtopic.php?f=24&t=5428&p=37720
Changing the background color of your page (and, in general, how to get at the css file for your game): viewtopic.php?f=24&t=5990

4) Yes, "seen" is understood by Squiffy.

5) It may be possible to nest {if} conditions inside each other. If it doesn't work or gets too complicated though, you may want to use JavaScript instead.

Dennis Carlyle
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:

. . . .



I've found things become clearer by deciding to actually learn Javascript, which I believe you probably would need to use for some of the things you've asked about here. Once I realized that, and started with the JS tutorial here -

http://www.w3schools.com/js/

. . . using JS didn't seem so daunting. It's got a "learning curve," yes -- but it's not too steep.

Dennis Carlyle
I've been looking at Squiffy's if/else statement, and found out a few things that aren't specifically made clear in the docs. So - for those who didn't know . . . . (with apologies, if this has already been covered ) ...

It's a useful thing, for sure -- but it only, it seems, works with text strings. True, the docs say "You can conditionally display text depending on the value of an attribute . . . ", but people used to using if/else in programming languages might be forgiven for thinking it should be workable with other stuff too.

Yes, you can nest if/else statements. 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'.

You can also use the "embed" text from another section/passage, as long as the embedded passage contains only text (it can include hyperlinks). Anything else may be included 'as text', or cause other problems.



@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.

bgbg
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'.


Oh, interesting. I've been fiddling around with this and either Squiffy is finicky or i'm doing something wrong. This code:

@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.

Dennis Carlyle

works for the medium and high score ranges, but not for the low score range. I don't know why.



I think I found (some kind of) a solution. I said above that you can't have a space between the variable and the operator. So we know "if x < 4" -- (with spaces) won't work. But now it looks like there are also at least some situations where *not* having a space between the operator "<" and the number being compared "4" -- will also cause a problem. So, if you change the code in your example to this:

if(space)x<(space)4:

. . . then it seems to work. (And changing other parts of your example doesn't break them either.)

I did a couple of tests with my own code examples, and didn't see any problem with no-space "x<4" flagging correctly, using 'if'. So it seems to be something like an "under certain conditions in the code" kind of bug. I suspect (?) (space)x<(space) is going to be a reliable form (until possible revisions), but who knows . . . it may be susceptible to certain code conditions as well.

Maybe you should leave your post above just as it is, so Alex or someone else can check it out as a possible 'bug' in the program.

bgbg
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.)

Dennis Carlyle
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.)


That's good to hear. JS has if/else, of course, but also "switch/case", which I find a bit easier to read.

This topic is now closed. Topics are closed after 180 days of inactivity.

Support

Forums