PDA

View Full Version : RPVerbs Script



Mathari
05-04-2014, 11:40 AM
I'm just posting this to let people know about a script that I've uploaded to the repository and that I hope will be helpful.

But first, a disclaimer! I dabble here and there in programming, but I am not a programmer, and I am pretty unfamiliar with Ruby and the Lich API. I hacked this script together pretty quickly (because I wanted it!) using my prior knowledge of programming in general and a Ruby quick reference. That being so, please let me know if something in my code is totally stupid or could be done way better/more efficiently!

Anyway, on to the script...

General Description

Basically, if you've used Greminty's QVS (for Stormfront only -- see the House Sylvanfair website for details), you pretty much already know what RPVerbs does. The script allows you to search for verbs that you can use for RPing (i.e., non-functional, emote-style verbs). I'll give a few examples in a second. But I first want to note some benefits (in my view) of using this script as compared to QVS (with no hate intended toward QVS, which is an extremely valuable script!): (1) as a Lich script, this one works in Wizard, Stormfront, or whatever other front end you use; (2) the QVS is over 20000 lines of code, since it had to deal with Stormfront crap; this script is 95 lines of code (the separate verb data, stored in a separate XML file, is a bit over 9000 lines); (3) the verb "data" (information about the verb's name, the verb's modifiers (e.g., BEG HEAL, BEG SILVER, etc.), the conditions under which the verb can be used (e.g., dead, stunned, etc.), and the verb's output text) are stored in a separate XML file that is very easy to read and modify without looking through or adjusting any code (the same is not true of the QVS), so you can easily add stuff to your own copy without having to edit code (it'd be nice if you also passed on the new verb data to me, of course). Hurray!

Usage and Examples

To use the script, you need to get rpverbs.lic from the repos, as well as rpverbs_data.xml (if you try to run the script without this file, it'll tell you to download it). I think you'll also need to ;trust rpverbs before running it, since the script needs permission to read from the rpverbs_data.xml file, which is on your hard drive (if this makes you uneasy, please read through the script before running it to make sure that it does what you think it does). Then, you use it like so:


;rpverbs <search_term>

search_term can be pretty much anything (this is another benefit over the QVS, which has a more limited search): a verb name, a condition (e.g., "stunned"), a profession or race (e.g., "sorcerer," "half-elf"), a full-word part of the verb's output (e.g., ";rpverbs mystically" will find the WAGGLE verb, since waggle's output has "waggles her [or his] fingers mystically"), or even multiple words in sequence (though you'll have to enclose the words in quotes for this to work -- for example: ;rpverbs "waggles her fingers"). Here are three examples of a search and the results:


>;rpverbs "swears fluidly"
SWEAR {person} FLUID
Condition: ELF
Output: Elf swears fluidly and vividly at {person}.

SWEAR FLUID
Condition: ELF
Output: Elf swears fluidly and vividly.


>;rpverbs glare
DISDAIN GLARE
Condition: ELF
Output: Player stares around the room, one eyebrow arched in an arrogant, but quizzical, expression..

GLARE
Condition:
Output: Player glares.

GLARE {person}
Condition:
Output: Player glares at {person}.


>;rpverbs sorcerer
CHANT
Condition: SORCERER
Output: The whites of Sorcerer's eyes go dark as he chants forcefully in an archaic tongue.

GAZE {person}
Condition: SORCERER
Output: Sorcerer shifts her eyes to {person}.

GREET {person}
Condition: WARRIOR to SORCERER
Output: Warrior nods curtly to {person}.

SACRIFICE {person}
Condition: SORCERER
Output: Sorcerer glares at {target} with a murderous glint in his eyes, his lips tightening into a cool sneer.

Try it out, enjoy it, and let me know if you break it (though I hope you don't). You can also let me know if you want a verb added to the XML file, if it isn't already there! (Again, you can easily add it to your own XML file, and that will work for you... But passing it on helps others!)

Acknowledgements

-Thanks to Greminty for making the QVS, which I've used a lot, which inspired this script, and from which I was able to easily get verb data.
-Scripts written by Tillmen, Spiffy, and Gib showed me the basics of parsing XML in a Lich script.

Mathari
05-04-2014, 12:16 PM
Okay, I just uploaded a version that prevents any duplicates in the output (thus fixing the small bug I mentioned). Since probably very few people have even used the script or read the OP at this point, I'm editing it out of the OP as well.

Tgo01
05-04-2014, 12:25 PM
This looks like a snazzy script.

Mathari
01-06-2020, 09:35 AM
I left the game for a while, but came back recently. I saw that this script was broken, so I made it work again, and put it back up on the Lich repo. There's lots of room for improvement (haven't had time to do much with it yet), but it works! If you see things that are missing or want to send me improvements, please let me know.