Stargazer for MUSHclient

by Amalii

Back to Mechanic's Corner.

Amalii2010-12-19 14:37:01
A little while ago, Tsianina Skyplume released a book entitled Astrology Ephemeris, documenting the results of her astrological research project on the movements of astrological bodies. Most helpfully, one of the appenices included fantastic formulas for calculating planetary positions, which (with the invention of watches) boast unprecedented accuracy.. Using these, I've devised a MUSHclient plugin that will accurately track both the passage of time (synching with 'date'/'probe watch' or the announcement of new days) and the movement of celestial bodies through the sheer power of math alone. The code was all complete some time ago, but thorough alpha testing took some time.

Since this plugin neither relies upon nor at any point ever interfaces with actual astrolabes (unlike past helpers), it can be used to invalidate them entirely, to streamline astrology (with its helpful commands), and to aid non-astrologers in knowing what's available to friends/foes at any time. No actual skill in Astrology is required for any part of this plugin except for translated nativities.

Stargazer 1.0 for MUSHclient is available for free, though donations are encouraged. If you don't want to spend 300 credits on an astrolabe, installing this plugin and passing on some of those savings to Vadania and Tsianina would be greatly appreciated.

Feature list:
- Time tracking : Accurate stargazing requires knowledge of the exact hour, which requires either midnight to pass (at which point timers and triggers will take over) or that you possess a watch (which need only be probed once upon login, and which Stargazer will attempt to automatically do).
- 'sg' or 'sg ' : Precise stargazing on command without need for astrology skill, an astrolabe, or equilibrium loss. Includes the option to focus on specific signs as with a real astrolabe.
- 'nativity ' : Translate nativities automatically into their ray effects. (Astrologers only.)
- 'sg spheres' : Table of all spheres and their current ratings, color-coded for telling at a glance whether they will be 'guaranteed positive', 'probably positive', 'probably negative', or 'guaranteed negative'.
- 'sg rays' : List of the current sign-based ray effects, sorted by sign.

The code is not as efficient as possible because Lua is not my weapon of choice and I made some deliberately lazy choices, but none of this should be visible from a user standpoint. I easily fixed every bug I ran across, but there may be more lurking -- if so, just let me know. I will gladly fix them and update as necessary. Additionally, Stargazer makes heavy use of MUSHclient notes, the default color for which is light blue, if I recall. If you do not wish Stargazer reports to be in this color, then change your default note color in MUSHclient's settings. This will affect every readout except for most of the 'sg spheres' table.

If you have questions, comments, or feature requests, please either message Vadania or post in this thread.

Here, go nuts.



12/12/2010: Stargazer 1.0 for MUSHclient is complete. Possible future features: optional realtime notification of planetary motion, nativity storage database to remove equilibrium cost for previously viewed individuals, more verbose version of 'sg spheres' that translates +/- numbers to actual effects, streamlined commands for prediction of future dates and configurations.

12/19/2010: 1.01 released. Update adds another layer of complexity to the watch-related regex and some supporting code, enabling the recognition of the full array of timepieces, as well as supporting watch readouts of 'noon' and 'midnight', which were previously expected to be displayed differently. Updating is recommended if you intend to use a watch with Stargazer.

12/29/2010: 1.02 released. Update replaces 'probe watch' with 'read watch' to reduce spam, now accurately updates date/time at login (messages sending too fast resulted in unexpected prompts appearing before the readouts), and implemented a variant of Caerulo's 'sg planets' modification (thank you, Caerulo!). world.Note retained over a hard-coded world.ColourNote to allow flexibility: just change your default note color in World Properties->Scripts and all Stargazer output will change colors accordingly.
Unknown2010-12-19 14:43:23
This was the very first thing I thought of when I saw Tsianina's amazing tome, but I lack the coding and the math to do so myself. I've been considering switching over to Astrology for buffing myself and other people, so this is very nice.


In short, WOO! cheer.gif
Sylphas2010-12-19 19:13:04
That's awesome! Although you've just doomed me to at some point porting/rewriting it for Mudlet. sad.gif
Asmodea2010-12-19 23:16:32
I don't suppose anyone has one of these for Zmud?
Unknown2010-12-19 23:56:44
WOW. Nice job!
Sylphas2010-12-20 00:25:05
QUOTE (Asmodea @ Dec 19 2010, 06:16 PM) <{POST_SNAPBACK}>
I don't suppose anyone has one of these for Zmud?


With the math both researched and now put into code, porting it shouldn't be hard, just really tedious. That MUSH stargazer has 2200+ lines of code.
Tsianina2010-12-20 00:33:47
I've written the zMUD code to generate what the astrolabe would tell you for any date you choose, but that's as far as I've gotten. That's really simple though, so I assume that's not what you're really looking for. It's not really in a state to be shared, though; it's somewhat intertwined with other stuff of mine. But it's pretty trivial stuff, just a direct reflection of the formulae. For instance, this is what shows Sidiak's status on the specified date:

CODE
  S = @fDateDiff(@sAstrologyStargazeDate, "275-08-16")
  S = %mod( 2 * @S, 240)
  #if (%number( %word( @sAstrologyStargazeDate, 4, "-")) < 4) {S = %mod( @S + 239, 240)}
  #if (%number( %word( @sAstrologyStargazeDate, 4, "-")) >= 16) {#add S 1}
  R = %eval( @S / 19)
  R = @fAstrologyPtoS(@R, @S, 222, 227)
  #show - %format( "&-6s", "Sidiak") : @R
Amalii2010-12-20 00:41:06
To be fair, some of it would be redundant translation, as rather than actually learning Lua and creating proper functions I just inserted the position calculation code wholesale in a few places (the hourly calculation timer, the trigger that catches the 'date' command output, the trigger for midnight arriving, and the manual 'sg update' command). It's a little messier, but the mechanical result is identical.

If you isolate the duplicate code, you can probably cut your work in half, but really you might be best off just working from scratch given that your medium of choice may not support Lua anyway.

Tsianina's formulas are already written in pseudocode, which makes it very easy to copy over almost directly. From there, the only mandatory inclusion is the ability to accurately collect and track the current date and hour (in this case, we check 'date' and 'probe watch' at login, then use timers to update the hour every 2.5 real minutes and synchronize for perfect accuracy when midnight is announced). The rest is all UI, which can be as minimalist or as fancy as you want. I get an awful lot of use out of 'sg spheres' and a combatant would get a lot out of 'sg rays' and the nativity translations, but hypothetically all you really need are 'sg' and 'sg '.

That said, I'm glad to hear that people find it to be a useful tool, and if I can find the time I might translate it over to some other systems myself eventually. I wouldn't hold out for it, though.


Edit to avoid double post: New version released and edited into the OP, consisting entirely of watch-related bug fixes. Details can be found above.

Edit #2: Hi, I'm Vadania, and I want to talk to you for a moment about your watch. Have you ever really stopped and noticed how complex (read as: annoying) your watch is? Consider the phrase, "The hands on a snowflake watch read nine o'clock at night." Looks simple to translate into a number, right? Hahahahahahaha, no. First, your watch can optionally throw in 'about half past' when the time is right. That's easy enough to get around, though. Next, you have to differentiate between 'at night' and 'in the morning' -- but wait! Before you do that, realize that 'at night' will sometimes display as 'in the afternoon' or 'in the evening' depending on exactly what time it is! So you have to account for those, too. Think you're done now? Of course you aren't, because at noon and midnight your watch is just going to straight up say, "The hands on read midnight/noon." So the next time you probe your watch to see what time it is, maybe take a moment to appreciate how painfully complex that readout is. This recent update was brought to you by that very complexity (as well as a silly mistake).
Unknown2010-12-27 13:22:07
I copied and modified the 'sg rays' command to let you see what effects you get when casting a particular heavenly body.

Just copy the below into the plugin
CODE
name="CheckPlanets"
match="sg planets"
enabled="y"
expand_variables="y"
group="astrology"
send_to="12"
ignore_case="y"
sequence="50"
>
phase = { "Volcano", "Antlers", "Twin Crystals", "Dolphin", "Lion", "Crocodile", "Burning Censer", "Spider", "Dragon", "Skull", "Bumblebee", "Glacier", "Skull (Retro)" }

sun = @sun
moon = @moon
eroee = @eroee
sidiak = @sidiak
tarox = @tarox
papaxi = @papaxi
aapek = @aapek

world.ColourNote ("silver", "", "At present, heavenly bodies-based rays work as follows:")
world.ColourNote ("silver", "", "")

if sun == 1 then world.ColourNote ("silver", "", "Sun: Fire Damage") end
if sun == 2 then world.ColourNote ("silver", "", "Sun: Cutting Damage") end
if sun == 3 then world.ColourNote ("silver", "", "Sun: Psychic Damage") end
if sun == 4 then world.ColourNote ("silver", "", "Sun: Cold Damage") end
if sun == 5 then world.ColourNote ("silver", "", "Sun: Cutting Damage") end
if sun == 6 then world.ColourNote ("silver", "", "Sun: Asphyxiation Damage") end
if sun == 7 then world.ColourNote ("silver", "", "Sun: Asphyxiation Damage") end
if sun == 8 then world.ColourNote ("silver", "", "Sun: Poison Damage") end
if sun == 9 then world.ColourNote ("silver", "", "Sun: Fire Damage") end
if sun == 10 or sun == 13 then world.ColourNote ("silver", "", "Sun: Blunt Damage") end
if sun == 11 then world.ColourNote ("silver", "", "Sun: Poison Damage") end
if sun == 12 then world.ColourNote ("silver", "", "Sun: Cold Damage") end

if moon == 1 then world.ColourNote ("silver", "", "Moon: Hallucinate") end
if moon == 2 then world.ColourNote ("silver", "", "Moon: Dizziness") end
if moon == 3 then world.ColourNote ("silver", "", "Moon: Dementia") end
if moon == 4 then world.ColourNote ("silver", "", "Moon: Hallucinate") end
if moon == 5 then world.ColourNote ("silver", "", "Moon: Dizziness") end
if moon == 6 then world.ColourNote ("silver", "", "Moon: Dementia") end
if moon == 7 then world.ColourNote ("silver", "", "Moon: Hallucinate") end
if moon == 8 then world.ColourNote ("silver", "", "Moon: Dizziness") end
if moon == 9 then world.ColourNote ("silver", "", "Moon: Dementia") end
if moon == 10 or moon == 13 then world.ColourNote ("silver", "", "Moon: Hallucinate") end
if moon == 11 then world.ColourNote ("silver", "", "Moon: Dizziness") end
if moon == 12 then world.ColourNote ("silver", "", "Moon: Dementia") end

if eroee == 1 then world.ColourNote ("silver", "", "Eroee: Sensitivity") end
if eroee == 2 then world.ColourNote ("silver", "", "Eroee: Peace") end
if eroee == 3 then world.ColourNote ("silver", "", "Eroee: Love") end
if eroee == 4 then world.ColourNote ("silver", "", "Eroee: Sensitivity") end
if eroee == 5 then world.ColourNote ("silver", "", "Eroee: Peace") end
if eroee == 6 then world.ColourNote ("silver", "", "Eroee: Love") end
if eroee == 7 then world.ColourNote ("silver", "", "Eroee: Sensitivity") end
if eroee == 8 then world.ColourNote ("silver", "", "Eroee: Peace") end
if eroee == 9 then world.ColourNote ("silver", "", "Eroee: Love") end
if eroee == 10 or eroee == 13 then world.ColourNote ("silver", "", "Eroee: Sensitivity") end
if eroee == 11 then world.ColourNote ("silver", "", "Eroee: Peace") end
if eroee == 12 then world.ColourNote ("silver", "", "Eroee: Love") end

if sidiak == 1 then world.ColourNote ("silver", "", "Sidiak: Stupidity") end
if sidiak == 2 then world.ColourNote ("silver", "", "Sidiak: Epilepsy") end
if sidiak == 3 then world.ColourNote ("silver", "", "Sidiak: Confusion") end
if sidiak == 4 then world.ColourNote ("silver", "", "Sidiak: Stupidity") end
if sidiak == 5 then world.ColourNote ("silver", "", "Sidiak: Epilepsy") end
if sidiak == 6 then world.ColourNote ("silver", "", "Sidiak: Confusion") end
if sidiak == 7 then world.ColourNote ("silver", "", "Sidiak: Stupidity") end
if sidiak == 8 then world.ColourNote ("silver", "", "Sidiak: Epilepsy") end
if sidiak == 9 then world.ColourNote ("silver", "", "Sidiak: Confusion") end
if sidiak == 10 or sidiak == 13 then world.ColourNote ("silver", "", "Sidiak: Stupidity") end
if sidiak == 11 then world.ColourNote ("silver", "", "Sidiak: Epilepsy") end
if sidiak == 12 then world.ColourNote ("silver", "", "Sidiak: Confusion") end

if tarox == 1 then world.ColourNote ("silver", "", "Tarox: Recklessness") end
if tarox == 2 then world.ColourNote ("silver", "", "Tarox: Asthma") end
if tarox == 3 then world.ColourNote ("silver", "", "Tarox: Impatience") end
if tarox == 4 then world.ColourNote ("silver", "", "Tarox: Recklessness") end
if tarox == 5 then world.ColourNote ("silver", "", "Tarox: Asthma") end
if tarox == 6 then world.ColourNote ("silver", "", "Tarox: Impatience") end
if tarox == 7 then world.ColourNote ("silver", "", "Tarox: Recklessness") end
if tarox == 8 then world.ColourNote ("silver", "", "Tarox: Asthma") end
if tarox == 9 then world.ColourNote ("silver", "", "Tarox: Impatience") end
if tarox == 10 or tarox == 13 then world.ColourNote ("silver", "", "Tarox: Recklessness") end
if tarox == 11 then world.ColourNote ("silver", "", "Tarox: Asthma") end
if tarox == 12 then world.ColourNote ("silver", "", "Tarox: Impatience") end

if papaxi == 1 then world.ColourNote ("silver", "", "Papaxi: Ego Reduction") end
if papaxi == 2 then world.ColourNote ("silver", "", "Papaxi: Health Reduction") end
if papaxi == 3 then world.ColourNote ("silver", "", "Papaxi: Mana Reduction") end
if papaxi == 4 then world.ColourNote ("silver", "", "Papaxi: Ego Reduction") end
if papaxi == 5 then world.ColourNote ("silver", "", "Papaxi: Health Reduction") end
if papaxi == 6 then world.ColourNote ("silver", "", "Papaxi: Mana Reduction") end
if papaxi == 7 then world.ColourNote ("silver", "", "Papaxi: Ego Reduction") end
if papaxi == 8 then world.ColourNote ("silver", "", "Papaxi: Health Reduction") end
if papaxi == 9 then world.ColourNote ("silver", "", "Papaxi: Mana Reduction") end
if papaxi == 10 or papaxi == 13 then world.ColourNote ("silver", "", "Papaxi: Ego Reduction") end
if papaxi == 11 then world.ColourNote ("silver", "", "Papaxi: Health Reduction") end
if papaxi == 12 then world.ColourNote ("silver", "", "Papaxi: Mana Reduction") end

if aapek == 1 then world.ColourNote ("silver", "", "Aapek: Aeon") end
if aapek == 2 then world.ColourNote ("silver", "", "Aapek: Anorexia") end
if aapek == 3 then world.ColourNote ("silver", "", "Aapek: Scabies") end
if aapek == 4 then world.ColourNote ("silver", "", "Aapek: Aeon") end
if aapek == 5 then world.ColourNote ("silver", "", "Aapek: Anorexia") end
if aapek == 6 then world.ColourNote ("silver", "", "Aapek: Scabies") end
if aapek == 7 then world.ColourNote ("silver", "", "Aapek: Aeon") end
if aapek == 8 then world.ColourNote ("silver", "", "Aapek: Anorexia") end
if aapek == 9 then world.ColourNote ("silver", "", "Aapek: Scabies") end
if aapek == 10 or aapek == 13 then world.ColourNote ("silver", "", "Aapek: Aeon") end
if aapek == 11 then world.ColourNote ("silver", "", "Aapek: Anorexia") end
if aapek == 12 then world.ColourNote ("silver", "", "Aapek: Scabies") end

world.Send ("")



To use it, the command is 'sg planets'
Sample printout:
CODE
At present, heavenly bodies-based rays work as follows:

Sun: Fire Damage
Moon: Dizziness
Eroee: Peace
Sidiak: Epilepsy
Tarox: Impatience
Papaxi: Mana Reduction
Aapek: Scabies

I didn't like the printout being in blue, so I changed it to ColourNote silver, which is the default Lusternia colour.
If you want, you can always edit the command or the colour you want to print out.

Lastly, the script is still Vadania's, I just slightly tweaked the 'sg rays' alias and shuffled it around to make it print out in order.
Tsianina2010-12-27 15:10:19
QUOTE (Amalii @ Dec 19 2010, 07:41 PM) <{POST_SNAPBACK}>
we check 'date' and 'probe watch' at login

You might find 'read watch' less spammy.

QUOTE (Amalii @ Dec 19 2010, 07:41 PM) <{POST_SNAPBACK}>
Edit #2: Hi, I'm Vadania, and I want to talk to you for a moment about your watch. Have you ever really stopped and noticed how complex (read as: annoying) your watch is?

I went through the same thing when I was originally collecting data during the research stage.
Amalii2010-12-27 16:30:03
I was wondering if there was an easier way to check your watch than spammy probing, but couldn't find any help files or information on it. Very much appreciated!

I'll probably read over and mess with 'sg planets' later tonight and fold both changes in and re-upload the plugin -- thanks for the addition! I figured people would just use 'sg rays' for that as well, since it just means reading it from right to left, but it's definitely worth including.

Incidentally, as I think I noted in the OP, if you don't want notes to be blue then you can change your default note color in MUSHclient's settings. I left it just world.Note rather than an explicit world.ColourNote to give people the choice of what color they want, since I (though perhaps the only one) like to have text not generated by the MUD to be differentiated.

This setting is in World Properties->Scripting->Scripts->Note Colour if anyone else would like to switch off of the default blue. It'll be a lot easier than a mass find/replace for world.Note, especially since ColourNote requires two additional arguments for every part of the string you'd otherwise pass Note.

Edit: Apologies for the brief delay, but updated version has been posted. See changelog in OP.
Unknown2010-12-30 11:41:29
Yeah, I do know that you've noted that. I just prefer the default Note colour to be blue, while the more or less complete scripts I prefer to either be coloured, or the default silver for ease of reading.