Unknown2005-02-21 18:44:15
I've updated the TinyFugue scripts on my website. I've been changing them quite a bit over the past few weeks, havn't had the time to upload them until now. The ones that were there have been changed quite a bit, and many more were added. The address is http://www.bwbettin.com, but if you don't feel like navigating the site to find them you can just go here http://www.bwbettin.com/?fuseaction=programming_tinyfugue.
The scripts are availble in both Unix and Dos file formats. They're there in HTML as well if you just want to look through them with the syntax highlighted.
NOTE: The site will be down for about a half hour today (2/21/05) starting at 5:30pm EST so I can switch out some hardware on the server. Sorry of any inconvenience if you're reading this for the first time at 5:30pm EST
Some Changes of Note:
* tfrc *
* curing *
* defup *
* forging *
* keybindings *
* status_prompt *
* tracking *
* utility_movement *
There's probably a bunch of other stuff that I added or changed, but I think this list is long enough already. Just look through the code and pick out what you like

The scripts are availble in both Unix and Dos file formats. They're there in HTML as well if you just want to look through them with the syntax highlighted.




Some Changes of Note:
* tfrc *
QUOTE
- Added some commands to make loading, unloading, and reloading scripts easier (sload, sunload, sreload). Very handy if part of your system goes bonkers, or if you make changes to any scripts while connected to Lusternia and want to see how they work.
- I started using the priority option for triggers. This makes it possible to highlight player names and call kinds of fun stuff. At the moment I'm using this priority scheme:
p4 (no fall-thru): used rarely, only to do internal functions like deleting triggers and things.
p3 (no fall-thru): most triggers, anything that won't require specific names/words to be highlighted.
p3 (fall-thru): any triggers that may additionally need specific names/words highlighted.
p2 (fall-thru): specific highlighting of names/words (enemies, allies, etc).
p1 (no fall-thru): Â targeting highlight.
- I started using the priority option for triggers. This makes it possible to highlight player names and call kinds of fun stuff. At the moment I'm using this priority scheme:
CODE
p4 (no fall-thru): used rarely, only to do internal functions like deleting triggers and things.
p3 (no fall-thru): most triggers, anything that won't require specific names/words to be highlighted.
p3 (fall-thru): any triggers that may additionally need specific names/words highlighted.
p2 (fall-thru): specific highlighting of names/words (enemies, allies, etc).
p1 (no fall-thru): Â targeting highlight.
* curing *
QUOTE
- Very basic health sipper. Only takes into account your hp and health balance. Eventually this will take everything else into account as well, but at the moment I'm too small to be PKing or bashing anything that gives complicated afflictions. Included a command to enable/disable the health sipper so if you do run into problems you can turn it off quickly without any trouble.
* defup *
QUOTE
- Basic start to a defup script. This is definitly not the cleanest or easiest way of doing it, but it works for what I need right now and I havn't had time to mess with restructuring it. When I redo it i'll use a stack and a loop and all will be right in the world.

* forging *
QUOTE
- Allows you to fire the forge, start, pause, restart, and stop a forging.
- Takes care of outr'ing correct comms and whatnot based on which item you're forging.
- Takes care of outr'ing correct comms and whatnot based on which item you're forging.
* keybindings *
QUOTE
- I only have one at the moment. It binds the "\\" key to recall and execute the previously sent command. Quite handy for me since my "\\" key is just above the Enter key.
* status_prompt *
QUOTE
- Included the health sipper to be checked whenever a prompt is received.
- Added replacements/highlights for the different types of balance.
- Didn't add in the code to have the script track Karma yet. Havn't really had a need for Karma, so my time was spent on other areas. Will be added in for the next update.
- Added replacements/highlights for the different types of balance.
- Didn't add in the code to have the script track Karma yet. Havn't really had a need for Karma, so my time was spent on other areas. Will be added in for the next update.
* tracking *
QUOTE
The enemies/allies list is still too small, this gets around that. It adds commands for you to handle enemies/allies, as well as highlights for people whom you consider enemies/allies but who are not on your main enemies/allies lists. Additional enemies would be enemies to your commune/city, allies would be people whom you go to for herbs/elixirs/forgings/etc. You get the idea.
- enemy/unenemy: adds/removes people from your enemies list, highlighting their name if they're on the list.
- ally/unally: adds/removes people from your allies list, highlighting their name if they're on the list.
- enemyh/unenemyh: adds/removes additional enemy highlights for people you consider your enemies, but who are not officially on your enemies list.
- allyh/unallyh: adds/removes additional ally highlights for people you consider your allies, but who are not officially on your allies list.
I also added markh/unmarkh commands which allow you to highlight specific words or parts of words. I use this to highlight npcs I regularly bash so that I get a nice visual cue when theyr'e in the room. I also use it when I'm shopping. If I'm looking for say galingale, I'll mark it then run around to shops and galingale will be highlighted on their wares list. Works exactly like the targeting highlight in targeting.tf, but isn't linked to any commands like your target is.
When the script first runs it executes COMMUNEENEMIES and adds ALL enemies of Serenwilde to my enemyh list. I can't even begin to describe how handy this is. Whenever an enemy is in the room they're highlighted. When they talk on channels they're highlighted. And it's all automatic. I reload the script every hour or so to make sure the highlights are all up to date. At the moment I enter my guild enemies by hand, but the vast majority of them (all but 1) are enemies of the commune, so it isn't a big deal. When I have access to the guildenemies command I'll make that Automated as well.
- enemy/unenemy: adds/removes people from your enemies list, highlighting their name if they're on the list.
- ally/unally: adds/removes people from your allies list, highlighting their name if they're on the list.
- enemyh/unenemyh: adds/removes additional enemy highlights for people you consider your enemies, but who are not officially on your enemies list.
- allyh/unallyh: adds/removes additional ally highlights for people you consider your allies, but who are not officially on your allies list.
I also added markh/unmarkh commands which allow you to highlight specific words or parts of words. I use this to highlight npcs I regularly bash so that I get a nice visual cue when theyr'e in the room. I also use it when I'm shopping. If I'm looking for say galingale, I'll mark it then run around to shops and galingale will be highlighted on their wares list. Works exactly like the targeting highlight in targeting.tf, but isn't linked to any commands like your target is.
When the script first runs it executes COMMUNEENEMIES and adds ALL enemies of Serenwilde to my enemyh list. I can't even begin to describe how handy this is. Whenever an enemy is in the room they're highlighted. When they talk on channels they're highlighted. And it's all automatic. I reload the script every hour or so to make sure the highlights are all up to date. At the moment I enter my guild enemies by hand, but the vast majority of them (all but 1) are enemies of the commune, so it isn't a big deal. When I have access to the guildenemies command I'll make that Automated as well.
* utility_movement *
QUOTE
- Added movement modes for basic walking, foraging, and sprinting, and a command to change modes.
If you're in basic mode ("mm basic" or just "mm"), the direction you went and came from are saved in variables dirfwd and dirrev. If your're in foraging mode ("mm forage"), everything works the same as in basic mode except that after you move you automatically try to forage for food. In sprinting mode ("mm sprint") you can use the movement commands you normally would when walking (n, s, e, w, etc) except that you sprint instead of walk. This makes it MUCH easier to quickly navigate the roads from place to place.
If you're in basic mode ("mm basic" or just "mm"), the direction you went and came from are saved in variables dirfwd and dirrev. If your're in foraging mode ("mm forage"), everything works the same as in basic mode except that after you move you automatically try to forage for food. In sprinting mode ("mm sprint") you can use the movement commands you normally would when walking (n, s, e, w, etc) except that you sprint instead of walk. This makes it MUCH easier to quickly navigate the roads from place to place.
There's probably a bunch of other stuff that I added or changed, but I think this list is long enough already. Just look through the code and pick out what you like


Ralshan2005-02-21 23:04:34




Morik2005-02-22 06:01:00
Nice work!
I've got some echo macros which I use for certain things:
/def echo_notice = /echo NOTICE: %*
/def echo_debug = /echo DEBUG: %*
/def echo_defup = /echo DEF UP: %*
... etc, etc. What this lets me do is sprinkle /echo_{whatever} throughout my tinyfugue code and use some simple conditionals to curb display.
Ie, the above could become:
/def echo_notice = /if (do_notice == 1) /echo NOTICE: %* %; /endif
/def echo_debug = /if (do_debug == 1) /echo DEBUG: %* %; /endif
.. etc.
Then, which is the fun bit, I can /also/ choose to log these debug commands to my log file but not displaying them on screen:
/def echo_notice = /if (do_notice == 1) /echo NOTICE: %* %; /else /test tfwrite(outlog, strcat("SENT GAGGED::", {*})) %; /endif
since a SEND trigger will catch everything you send (including echos) and so you on't need to tfwrite() to your log file handle (mine here is 'outlog') whenever you echo normally.
i'd also look at writing some macros to replace the repeated code: a great example is the 'dirrev' stuff in utility_movement.tf . You could write a dirrev macro which you can use in place of the two direction 'reversing' places - allowing you to use it later on if the need comes up.
I am, however, going to steal your city-enemy-snarfing code. Its very very nice!
I hope that helps.
A question: where'd you find the tinyfugue highlighting for vim? I might Give gvim a try and put my current code online.
I've got some echo macros which I use for certain things:
/def echo_notice = /echo NOTICE: %*
/def echo_debug = /echo DEBUG: %*
/def echo_defup = /echo DEF UP: %*
... etc, etc. What this lets me do is sprinkle /echo_{whatever} throughout my tinyfugue code and use some simple conditionals to curb display.
Ie, the above could become:
/def echo_notice = /if (do_notice == 1) /echo NOTICE: %* %; /endif
/def echo_debug = /if (do_debug == 1) /echo DEBUG: %* %; /endif
.. etc.
Then, which is the fun bit, I can /also/ choose to log these debug commands to my log file but not displaying them on screen:
/def echo_notice = /if (do_notice == 1) /echo NOTICE: %* %; /else /test tfwrite(outlog, strcat("SENT GAGGED::", {*})) %; /endif
since a SEND trigger will catch everything you send (including echos) and so you on't need to tfwrite() to your log file handle (mine here is 'outlog') whenever you echo normally.
i'd also look at writing some macros to replace the repeated code: a great example is the 'dirrev' stuff in utility_movement.tf . You could write a dirrev macro which you can use in place of the two direction 'reversing' places - allowing you to use it later on if the need comes up.
I am, however, going to steal your city-enemy-snarfing code. Its very very nice!
I hope that helps.
A question: where'd you find the tinyfugue highlighting for vim? I might Give gvim a try and put my current code online.
Morik2005-02-22 06:09:15
Ah, right, gvim comes with "Tf mud client' as a standard highlighting. Do you happen to have a little script somewhere to mass convert tf -> html (say, a directory worth of files) ? I've got 96 rc files to convert in my lusternia codebase and 184 in my achaean codebase.
Unknown2005-02-22 12:41:50
Thanks for the ideas for cleaning up the code. I know there are parts of it that are rather messy at the moment. Since I started my character only about a week ago, I've been more in the mood to get things working than to make it pretty
I'll probably go through it this weekend and clean it up.
I like the echoing trick you mentioned!
To convert the tf files to html I just use gvim's drop down menu and do it a file at a time. I havn't really looked for a script that does them all at once, or tried to write one. I'm sure it wouldn't be hard to script it though. To do those conversions I opened all of the files up in one gvim window. Selected the convert to html option from the dropdown menu. Then saved the file (:w). Then did :bd :bd (deleted a buffer, then another). Then repeated the process for the rest of the files.
That little process just screams "script me!", but I've never written any scripts for vim/gvim and wouldn't have a clue where to start. When I have more than a handful of files, I'm sure I'll have more drive to sit down and figure it out.

I like the echoing trick you mentioned!
To convert the tf files to html I just use gvim's drop down menu and do it a file at a time. I havn't really looked for a script that does them all at once, or tried to write one. I'm sure it wouldn't be hard to script it though. To do those conversions I opened all of the files up in one gvim window. Selected the convert to html option from the dropdown menu. Then saved the file (:w). Then did :bd :bd (deleted a buffer, then another). Then repeated the process for the rest of the files.
That little process just screams "script me!", but I've never written any scripts for vim/gvim and wouldn't have a clue where to start. When I have more than a handful of files, I'm sure I'll have more drive to sit down and figure it out.

Unknown2005-02-22 12:49:46
On another note, if you're going to use vim to edit your tf files make sure you have it setup to replace tabs with spaces. TF, at least my installation of it, eats tabs and doesn't send them properly. So if you spend 6 hours putting together a script to write an AD for lusternia, and it has tabs in it...it may look fine on your screen, but it'll look like crap when you send it to lusternia.
This is my .vimrc file:
set nocompatible
syntax on
let psc_style='cool'
let psc_cterm_style='cool'
let psc_fontface='plain'
let psc_inversed_todo=0
let psc_statement_different_from_type=0
colorscheme ps_color
highlight Normal guibg=#000000
set autoindent
set ruler
set showcmd
set incsearch
filetype plugin indent on
set nu
set wrap!
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
It's pretty basic. The most important part as far as spaces and tabs are concerned are the last four lines:
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
That turns tabs into 4 spaces. If you adjust your vimrc and then open a file, it doesn't retroactively fix your tabs/spaces. I was pulling my hair out trying to figure it out. A guy on #vim at freenode.net mentioned a ":retab" command. It sifts through the file and replaces all sequences of white-space that contain a Tab with a new string of white-space containing spaces, the number of which are defined by the "tabstop" option in your vimrc file. I still had to fix a few spots by hand, but it saved me a ton of time.
Just wanted to give you a heads-up before you ran into the same pain-in-the-ass problem I did
This is my .vimrc file:
CODE
set nocompatible
syntax on
let psc_style='cool'
let psc_cterm_style='cool'
let psc_fontface='plain'
let psc_inversed_todo=0
let psc_statement_different_from_type=0
colorscheme ps_color
highlight Normal guibg=#000000
set autoindent
set ruler
set showcmd
set incsearch
filetype plugin indent on
set nu
set wrap!
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
It's pretty basic. The most important part as far as spaces and tabs are concerned are the last four lines:
CODE
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
That turns tabs into 4 spaces. If you adjust your vimrc and then open a file, it doesn't retroactively fix your tabs/spaces. I was pulling my hair out trying to figure it out. A guy on #vim at freenode.net mentioned a ":retab" command. It sifts through the file and replaces all sequences of white-space that contain a Tab with a new string of white-space containing spaces, the number of which are defined by the "tabstop" option in your vimrc file. I still had to fix a few spots by hand, but it saved me a ton of time.
Just wanted to give you a heads-up before you ran into the same pain-in-the-ass problem I did

Alger2005-02-23 02:24:36
if you guys can upload my scripts somewhere id be happy to share them with you guys... well... its not much but hey if you want!
Morik2005-02-23 02:26:11
QUOTE(Alger @ Feb 23 2005, 10:24 AM)
if you guys can upload my scripts somewhere id be happy to share them with you guys... well... its not much but hey if you want!
57608
Sure thing - message me in-game and I'll arrange some webspace.
Alger2005-02-23 02:28:28
okay ill be home in a bit
Alger2005-02-28 06:00:17
okay im having trouble organizing my scripts -.- i look at them and i go nobodys going to understand this....
Unknown2005-02-28 13:32:53
My biggest complaint with TF scripting is that you cannot have comments in the middle of your code. It's the tradeoff to being able to script on the fly and fit everything on one line, but it means code is hard to figure out.
The way I've tried to remedy this is to separate the scripts out into files with names they're relevant too; such as "tracking", "status_prompt", "targetting", "curing", etc. I also make variable and def names way longer than I like. Things like "/def sip_health_if_needed" drive me nuts. I don't like looong names for things; but the upside to it is that it makes more sense to someone who doesn't know what that macro does than "/def shealth" or something like that.
If you have a ton of scripts that use other scripts that use other scripts it'll be too much of a pain to go back and rename your macros and variables. You're better off sticking good comments before the macros, and maybe at the head of the file to state what it's purpose is (the big picture). I try to stick a "Syntax" comment over complicated macros that's similar to a unix manpage entry. That way people can discern what the purpose is and how to use it without analyzing the code and figuring it out.
I still don't know why my website is down. Hopefully my computer didn't blow up or something. It's probably just RoadRunner booting me off and I'll need to restart the cable modem and router. I'll be heading to my apartment for lunch later this afternoon (12ish EST) and get it back online.
The way I've tried to remedy this is to separate the scripts out into files with names they're relevant too; such as "tracking", "status_prompt", "targetting", "curing", etc. I also make variable and def names way longer than I like. Things like "/def sip_health_if_needed" drive me nuts. I don't like looong names for things; but the upside to it is that it makes more sense to someone who doesn't know what that macro does than "/def shealth" or something like that.
If you have a ton of scripts that use other scripts that use other scripts it'll be too much of a pain to go back and rename your macros and variables. You're better off sticking good comments before the macros, and maybe at the head of the file to state what it's purpose is (the big picture). I try to stick a "Syntax" comment over complicated macros that's similar to a unix manpage entry. That way people can discern what the purpose is and how to use it without analyzing the code and figuring it out.
I still don't know why my website is down. Hopefully my computer didn't blow up or something. It's probably just RoadRunner booting me off and I'll need to restart the cable modem and router. I'll be heading to my apartment for lunch later this afternoon (12ish EST) and get it back online.
Alger2005-03-01 07:50:26
yeah i tried segregating them a bit but then everything is connected to each other in someway... :\\ i dunno im looking at 28 files and i dont know how to give them to morik.