How to do multiple operations on Bitsy 4.2


I came cross with the limitation of using conditional dialog's syntax as I cannot do multiple operations or like

  • a == 1 and b == 2
  • a + b + c == 2
  • a = a + 1
  • a + b * 2 < c

In this game, player has to find 1 lighter, 3 combs and 3 rings respectively in order to get the price. On each progress, buyer has to say different sentences. So, here is my conditions.


<<Lua>>
if lighter == 1 and comb == 3 and ring == 3 then
  temp = 3
elseif lighter == 1 and comb == 3 then
  temp = 2
elseif lighter == 1 then
  temp = 1
else
  temp = 0
end


<<Bitsy Script>>
{
  - 1 == {item "lighter"} ?
    {temp = 1}
  - else ?
    {temp = 0}
}{
  - 1 == temp ?
    {
      - 3 == {item "comb"} ?
        {temp = 2}
    }
}{
  - 2 == temp ?
    {
      - 3 == {item "ring"} ?
        {temp = 3}
    }
}{
  - 0 == temp ?
    Hello, I buy {wvy}Bric-A-Brac{wvy}.
    But I need {rbw}a lighter{rbw} first.
  - 1 == temp ?
    {wvy}Thanks for the lighter!{wvy}
    Could you find {rbw}3 combs{rbw} for me?
  - 2 == temp ?
    {wvy}Thanks for the combs and the lighter!{wvy}
    Now find {rbw}3 rings{rbw}.
  - 3 == temp ?
    {wvy}Thanks for the rings, combs and lighter!{wvy}
    (He gave you {rbw}$1{rbw})
}


<<Shorter Version>
{
  - 1 == {item "lighter"} ?
    {temp = 1}
  - else ?
    Hello, I buy {wvy}Bric-A-Brac{wvy}.
    But I need {rbw}a lighter{rbw} first.
    Find it and bring it back to me.
}{
  - 1 == temp ?
    {
      - 3 == {item "comb"} ?
        {temp = 2}
      - else ?
        {wvy}Thanks for the lighter!{wvy}
        Could you find {rbw}3 combs{rbw} for me?
    }
}{
  - 2 == temp ?
    {
      - 3 == {item "ring"} ?
        {wvy}Thanks for the rings, combs and lighter!{wvy}
        (He gave you {rbw}$1{rbw})
      - else ?
        {wvy}Thanks for the combs and the lighter!{wvy}
        Now find {rbw}3 rings{rbw}.
    }
}

Files

index.html.zip Play in browser
Nov 28, 2017

Leave a comment

Log in with itch.io to leave a comment.