Plan for magic variables in HamsterSpeak

From OHRRPGCE-Wiki
Jump to navigation Jump to search

hamsterspeak is a very wordy language, so some fairly simple operations can look quite monsterous when typed out:

# add 5 to HP
set hero stat(who, stat:hp, get hero stat(who, stat:hp))

Suppose we add syntax for creating magic variables. something like:

magic variable(hero hp(who), set hero stat(who, stat:hp, IN), get hero stat(who, OUT))

This would create "hero hp" which would be usable like this:

# Write
hero hp(0) := 100
# Read
show value(hero hp(0))

Or maybe Macros[edit]

Or another way of thinking about this is as macros.

getter macro(hero hp(who), get hero stat(who, stat:hp))
setter macro(hero hp(who):=n, set hero stat(who, stat:hp, n))

Somehow that syntax feels a little cleaner to me.


Revise.png
This article or section is not complete. If you wish, you may finish it, and remove this tag when you are done.