Okay. So, I separate things out as much as possible. First, I put all my code for building a UI into
Okay. So, I separate things out as much as possible. First, I put all my code for building a UI into one folder; then, I separate out the things for building a model of the data that the UI uses into another folder. That probably sounds kinda weird, but bear with me.
So, I keep a table (of tables) of all the important information that the game sends me. It often looks something like this:
Then, I create another folder of event handlers, to update my information. Those handlers look something like this:
Now, finally, I have all of my data separated out, configured into the Types that I need, and ready to go. This lets me plug it in pretty seamlessly elsewhere. I actually do end up modifying bars, etc with a
prompt
type trigger still, because I can guarantee that on a prompt, I have received all gmcp events that are relevant to me.
8 Replies
I use values like
me.vitals.hpdiff
so I can put those things on my prompt. I didn't use SVO, so this was necessary for achieving feature parity.
I know this seems like more up-front work, but it saves you a lot down the road, but not having to tonumber(gmcp.Char.Vitals.hp)
all the time 😄
and also do fun things like:
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yes, also, that's only ever called once
the code you copied there; it's just to have some values available when you turn on Mudlet
the
or
makes sure those values don't overwrite current, real values (updated by the gmcp hooks)
onVitals
, for example, is registered to gmcp.Char.Vitals
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
that's right
The biggest use of this process here here is that I am A) turning strings into numbers where strings are not useful for me, and B) able to derive new information from old
er... no
I am able to derive new information beyond what it just gives me (such as the difference between values between prompts)
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
For sure! This was the best part of Achaea for me, when I played 😂
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View