I'm a beginner, I started using Twine today.
I want to make a link that works only after you click both of 2 hooks.
I'm not a native speaker of English, so I write in my own language. Also, I don't understand all things that are in Twine.
Here's what I have:
[Kurtka]<getKurtka|
[Buty]<getButy|
Ubieram się i wychodzę z domu->Droga do szkoły
(set:$kurtkaCheck to false)
(click: ?getKurtka)[
Założyłaś kurtkę.
(set:$kurtkaCheck to true)
]
(set:$butyCheck to false)
(click: ?getButy)[
Założyłaś buty.
(set:$butyCheck to true)
]
I want to make "
Ubieram się i wychodzę z domu->Droga do szkoły" link activate when you click both Kurtka(jacket) and Buty(shoes). "Ubieram się i wychodzę z domu" means "I put on my outerwear and leave the house".
I want to make it so, if you don't get a jacket and shoes you can't go to school.
For example, this link can be hidden until you click the jacket and shoes or just un-clickable.
Thanks in advance.
Comments
[Kurtka]<getKurtka|
[Buty]<getButy|
(set:$ubranieCheck to 0)
(set:$kurtkaCheck to false)
(click: ?getKurtka)[
Założyłaś buty.
(set:$ubranieCheck to it +1)
(set:$kurtkaCheck to true)
]
(set:$butyCheck to false)
(click: ?getButy)[
Założyłaś buty.
(set:$ubranieCheck to it +1)
(set:$butyCheck to true)
]
(if: $ubranieCheck is 2)[Wychodzisz z domu->Droga do szkoły]
However, I think that "set:$ubranieCheck to it +1)" doesn't work. How can I make it so the $ubranieCheck (ubranie means clothes) is 2?
Your (set: $ubranieCheck to it +1) are working but the (if:) macro in your solution is only executed when the passage is first shown to the Reader, so the condition will fail because $ubranieCheck will not equal 2 at that time.
Try the following ... I changed a couple of things in your original example:
1. I added collapse { and } markup so that the logic code can be laid out so it is more readable.
2. I used (replace:) macros to move where the "Założyłaś ......" related text appears after a link is clicked.
3. I added the $kurtkaCheck and $butyCheck check which causes the "Ubieram ..." markup link to be shown.
note: The code added in point 3 appears in two places, once within each markup link and this duplication could be considered incorrect/wasteful by a programmer. Although the above solution could be changed so that the (if:) macro (and its related (replace:) macro) were placed in a child passage which could be included in each markup link using a (display:) macro, I believe doing so is not necessary in this case.