freeinklewriter icon indicating copy to clipboard operation
freeinklewriter copied to clipboard

Update Tutorial with Inline Conditional Usage

Open mewsalamence opened this issue 4 years ago • 6 comments

This repository's issues are reserved for feature requests and bug reports.

  • I'm submitting a ...

    • [ ] bug report
    • [X] feature request
    • [ ] support request => Please do not submit support request here, see note at the top of this template.
  • Do you want to request a feature or report a bug? Request a Feature

  • What is the current behavior? Tutorial doesn't go over inline operators such as 'and', 'or', or comparison operators.

  • What is the expected behavior? The tutorial should go further in depth of advanced conditionals and how they operate.

  • What is the motivation / use case for changing the behavior? I don't know how to use "or" inline conditionals or if they exist.

mewsalamence avatar Nov 21 '20 01:11 mewsalamence

Indeed, inline part is left quite like a demo/sample of what it could do. I haven't given it much try but it seems like comparison operators do work. I'll give it some more testing. { marker == x : 1 | 2 } statements like this are possible. Possible conditionals that work are != >= <= > < I've used != and > so far and they work like a charm. From what I gather, inline conditionals might be similar to ink. Alright for 'and' and 'or' conditionals && and || works. Certainly the tutorial could be enhanced a little. Another thing to experiment could be nested inline statements.

So { marker1 == x && marker2 > y : statement1 | statement2 } works well.

RaXorX avatar Nov 22 '20 10:11 RaXorX

It seems like boolean conditionals cannot use the "or" statement and are more strict.

{ marker1 and marker2: statement1 | statement2 } or { marker1 && marker2: statement1 | statement2 } If you have marker1 and marker2 as true, then statement1 will appear for the above. If either are false, then statement2 will be used.

{ not marker1 and marker2: statement1 | statement2 } or { !marker1 && !marker2: statement1 | statement2 } If you have marker1 and marker2 as false, then statement1 will appear for the above. If either are true, then statement2 will be used.

That's where I'm having trouble.

  • "not" and "and" / ! and && can be used, but not "or" / ||.
  • "not" with "and" statements will make all markers false if put at the beginning. It will break if placed anywhere else.
  • You have to have both markers beginning with an ! when using && or it will not take.
  • Trying to use { marker1 == true } will not accept.

~~Apologies if I don't understand boolean. I feel like it should work similar to the number comparison, but I could be wrong.~~

I tried using the number comparison with the ||, but it also seemed to break in the inline. It feels like InkleWriter doesn't have "or" statements implemented, unless I am writing it wrong or have an outdated version of the site on my end.

Writing it as { marker1 == 1 || marker2 > 4 : statement1 | statement2 } where "marker1 = 1" and "marker2 = 1" brings up statement2. Removing "| statement2" greys out the inline and doesn't appear. Possible bug, or the "or" statement isn't implemented in InkleWriter.

mewsalamence avatar Nov 23 '20 06:11 mewsalamence

Thanks for the report. Very interesting point discussed here, so much that it opens multiple paths of evolution.

Is there a complete guide about all the syntaxical features of inklewriter somewhere?

We should make sure we have such a thing, which will provide all the available features with examples.

Next we could translate it for educational purpose.

Here's what I found

  • The inline tutorial
  • https://www.inklestudios.com/inklewriter/getting-started/
  • Youtube : https://www.youtube.com/results?search_query=inklewriter

Is the integrated tutorial to be modified / evolved?

As much as I like the app, I have mixed feelings about the tutorial part.

PRO

  • It certainly makes sense to have the tutorial show as an interactive story.
  • It is agreable to have it integrated in the "one page app" User Experience

CON

  • The code is kinda hairy to have a static story into a dynamic editor
  • You can't easily access a "syntax guide" while you're writing

I would propose transforming the tutorial experience like this :

  • The tutorial would be a "standard" story, easily edited and not anymore "baked in the code"
  • This would allow to have it for multiple languages
  • The aforementioned syntax guide

albancrommer avatar Nov 23 '20 09:11 albancrommer

The current tutorial helps walk users through how to use the basics, and it's very useful for beginners. Having it re-written as a separate "standard" story for accessible editing would be a good idea in the case of updates to InkleWriter. Much easier to edit the tutorial and push it for wide-spread InkleWriters. Multiple languages would also be an interesting addition. I look forward to seeing how this would be implemented.

mewsalamence avatar Nov 25 '20 02:11 mewsalamence

@mewsalamence Could you share your story in JSON format perhaps? I just tried a couple of things, and these are my observations.

  • Trying to use { marker1 == true } will not accept. The syntax is wrong. If you're checking whether the marker has passed or not, the correct syntax is { marker1 : statement1 | statement2 } If you're not checking whether it's false or true, or if you manually set the marker's value to be "true" then it works fine. In a nutshell, a comparison is done with a set value and not true and false.

  • "not" and "and" / ! and && can be used, but not "or" / ||. I looked into this. It is just as you said. { marker1 == x or marker2 >= y : statement1 | statement2 } { marker1 == x || marker2 >= y : statement1 | statement2 } Both of these kept throwing me the statement2 when in fact it should have been throwing the statement1 instead, provided one of those conditions were true, and they were. It didn't throw statement1 even when both the conditionals were true. It seems like a bug, or maybe the 'or' functionality just hasn't been implemented.

  • "not" with "and" statements will make all markers false if put at the beginning. It will break if placed anywhere else. From what I gather, 'not' acts for the entire set of conditionals, unlike '!' although I might be wrong here. So, this has to be included at the beginning and breaks if placed anywhere else.

  • You have to have both markers beginning with an ! when using && or it will not take. '!' acts per marker, as far as I know, hence it needs to be included with both the markers. If you used it with one variable only, the next would be parsed without '1' since there was none, to begin with.

RaXorX avatar Nov 25 '20 08:11 RaXorX

Sure.

Story Code {"title":"Conditional Testing","data":{"stitches":{"letsTestSomeCond":{"content":["Let's test some conditionals.",{"option":"Here We Go!","linkPath":"blankStitch","ifConditions":null,"notIfConditions":null},{"pageNum":1}]},"blankStitch":{"content":["",{"divert":"testerThisWillSh"},{"flagName":"tester = 1"}]},"testerThisWillSh":{"content":["{tester=1: This will show up if tester is [value:tester]/[number:tester].}",{"divert":"elseThisWillBeBr"}]},"elseThisWillBeBr":{"content":["Else, this will be broken.",{"option":"Continue...","linkPath":"thisWillTestMult","ifConditions":[{"ifCondition":"tester=1"}],"notIfConditions":null}]},"thisWillTestMult":{"content":["This will test multiple variables.",{"divert":"ifTestingAppears"},{"flagName":"testing2 = 2"},{"flagName":"testing1 = 1"},{"flagName":"testing3"}]},"ifTestingAppears":{"content":["If testing appears, {testing1 == 1:this message will appear}. If testing1 and testing2 appears, {testing1 and testing2:this message will appear}. {not testing4:testing4 doesn't exist.} {not testing1 and testing2:This message shouldn't appear.}",{"divert":"nowToFigureOutOR"}]},"nowToFigureOutOR":{"content":["Now to figure out OR.",{"divert":"TestingTestingTh"}]},"TestingTestingTh":{"content":["{ testing1 == 1 || testing2 \u003e 4 : This message should appear since testing1 = 1. }",{"divert":"TestingTrueTesti"}]},"TestingTrueTesti":{"content":["{ testing3 == true || testing4 == true : This message should appear since testing3 is true. }",{"divert":"TestingTestingTh1"}]},"TestingTestingTh1":{"content":["{ testing3 || testing4 : This message should appear since testing3 exists. Version with barlines. }",{"divert":"TestingOrTesting"}]},"TestingOrTesting":{"content":["{ testing3 or testing4 : This message should appear since testing3 exists. Version with or. }",{"divert":"TestingAndTestin"}]},"TestingAndTestin":{"content":["{ testing3 and !testing4 : testing3 and !testing4 }",{"divert":"TestingAndTestin1"}]},"TestingAndTestin1":{"content":["{ !testing4 and testing3 : !testing4 and testing3. }",{"divert":"NotTestingAndTes"}]},"NotTestingAndTes":{"content":["{ not testing4 and testing3 : not testing4 and testing3. }",{"divert":"NotTestingAndTes1"}]},"NotTestingAndTes1":{"content":["{ not testing4 and testing5 : not testing4 and testing5 }",{"divert":"TestingNotTestin"}]},"TestingNotTestin":{"content":["{ testing3 not testing4 : testing3 not testing4 }",{"divert":"NotTestingNotTes"}]},"NotTestingNotTes":{"content":["{ not testing4 not testing5: not testing4 not testing5 }",{"divert":"httpswwwinklestu"}]},"httpswwwinklestu":{"content":["[https://www.inklestudios.com/inklewriter/getting-started/|Use this for more information]. [https://www.inklestudios.com/2012/06/08/learning-logic-with-sherlock-holmes.html|Also use this]."]}},"initial":"letsTestSomeCond","optionMirroring":true,"allowCheckpoints":true,"editorData":{"playPoint":"httpswwwinklestu","libraryVisible":false,"authorName":"Anonymous","textSize":1}},"url_key":31687}
  • The syntax is wrong. If you're checking whether the marker has passed or not, the correct syntax is { marker1 : statement1 | statement2 } If you're not checking whether it's false or true, or if you manually set the marker's value to be "true" then it works fine. In a nutshell, a comparison is done with a set value and not true and false.

It can still be read as true/false in certain programming languages. I was using it for testing purposes.

  • From what I gather, 'not' acts for the entire set of conditionals, unlike '!' although I might be wrong here. So, this has to be included at the beginning and breaks if placed anywhere else.
  • '!' acts per marker, as far as I know, hence it needs to be included with both the markers. If you used it with one variable only, the next would be parsed without '1' since there was none, to begin with.

Sometimes it works in other places. Sometimes it doesn't. It bugged when testing it sometimes.

mewsalamence avatar Nov 25 '20 09:11 mewsalamence