My suggestion: don't dare something too "big" at once, but go for it step by step. Practice using if-then-else conditions, $calc-ulations, how to store data in global variables and maybe ini files later, etc.
Then, start with a simple structure, think about possible things to add later, but don't add it all at once. Let it grow instead.

You may start with a "plaintext" sketch of your script before you translate it to actual code, allowing to "play" different scenarios in your mind (and with your finger on the screen or paper), to find loopholes etc. Something like:
Code:
on text event {
  if its a valid order {
    if A orders coffee { ask white or black }
    elseif A orders white { pass white and increase %bill.of.A by ammount x }
    elseif A orders black { pass black and increase %bill.of.A by ammount x }
    elseif A orders peanuts {
      pass peanuts
      inform about the advantages of having a cold beer with the nuts
      increase %bill.of.A by ammount y
    }
    elseif... { ... }
  }
  elseif A orders the bill {
    if theres a %bill.of.A {
      inform A about the total of %bill.of.A 
      ask about payment method
    }
    else { laugh at A }
  }
  elseif A pays the bill {
    if he pays more {
      say thanks for the tip
      delete the %bill.of.A
    }
    elseif he pays less {
      decrease the %bill.of.A respectively
      inform A about the remaining debt
    }
    else {
      delete the bill.of.A
      bitch that there was no tip at all
    }
  }
}