The Skript book · Appendix D

Skript for Python and JavaScript Programmers

If you arrive with a programming language already in your head, this appendix is your fastest route in: the same intent, side by side. (Python shown; the JavaScript translation is the obvious one.)

IntentPythonSkode Skript
assignmentcounter = 0set counter to 0
incrementcounter += 1increase counter by 1
string buildf"Hi {name}""Hi {name}"
concatenation"a" + str(n)"a" + n
list literal["a", "b"]"a", "b"
appendxs.append(v)add v to xs
conditionalif x > 500: … else:if x is above 500 then … otherwise
substring test"vip" in s.lower()s contains "vip"
counted loopfor _ in range(3):repeat 3 times
iterationfor ch in chs:for each ch in chs
whilewhile c < 5:while c is below 5
functiondef welcome():to welcome the lead
callwelcome()welcome the lead
early exitreturn / sys.exit()stop
comment# note# note
printprint(x)log "{x}"

The deeper translations are about what is missing, and each absence follows from the language's purpose:

  • No parameters or return values. Skript functions share one namespace with the event — "set the stage, then say the sentence." Where you would design a signature, you name a variable.
  • No boolean operators in conditions. and/or compose steps, not tests. Conjunction is nesting; disjunction is two ifs; complex predicates become a well-named function.
  • No objects, dicts, indexing, imports, or I/O. The event is the record; the nine actions are the I/O; the marketplace is the import system. If you reach for a dictionary, the design is asking for Skode itself (or the SDK) rather than a skript.
  • No exceptions to catch. Errors halt the run with an English sentence and a line number. Guard clauses (if email is "" then … stop) replace try/except, and the sandbox replaces defensive programming.

The mental shift that makes Skript pleasant rather than confining: you are not writing an application, you are writing policy — the sentence a good operations manager would say out loud. Python remains the right tool for computing things. Skript is the right tool for deciding things, and it will refuse, politely and by design, to become the former.