TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Automatically write roomname & roomarea descriptors

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts
View previous topic :: View next topic  
Author Message
Pokaku



Joined: 23 Apr 2013
Posts: 3

PostPosted: Tue Apr 23, 2013 1:04 am    Post subject: Automatically write roomname & roomarea descriptors Reply with quote

Code:
#ALIAS {mapon}
{
   #event {MAP ENTER ROOM} {#log {overwrite} tinlog;#map set roomarea ${roomarea};#delay {0.3} {#SCRIPT {sed -u -n '1 p' <~/tinlog | cat ~/roomnameheader -}};#DELAY {0.3} {#LOG {off}};#DELAY {0.33} {#MAP name ${roomname}};${refresh.minimap}};
   #echo {Mapping enabled! Room Area = <229>${roomarea}<099>. Update with 'zone' command.};
   #map {flag} {static} {off}
}
{5}


This script only works on GNU/Linux! It requires sed, cat, touch, and echo to work.


If you would like to try this script out, the simplest way is to download this
TinTin++ save file with everything already setup and ready to go!.

https://home.comcast.net/~thilos2/tintin.auto.roomname.writer.tin

I've included a copy of the script at the bottom of this post, in case the link goes
dead.



An automatic roomname writing script, plus semi-automatic roomarea writing script:

The purpose of this script is to write room names automatically into #MAP, So you don't have to write
in each room's name manually by hand. This is useful for MUD servers that do not support out-of-band
communication protocols, such as GMCP.

All it does, is read the first line of text the MUD sends you, when you move in a new direction., Which is usually
the room's name. It then automatically writes this first line of text as the room's name, into #MAP

This script is also a semi-automatic room area writing script. You can
manually type in what zone or area of the MUD you are currently in, and
if the 'mapon' command is enabled, this info will automatically be
written into #MAP each time you move in a new direction
as well. See the 'zone' command below for more details.




******* IN ORDER FOR THIS SCRIPT TO WORK *******

TinTin must be started up using a saved Commands/Alias Save_File

Example: 'tt++ /path/to/tintin.auto.roomname.writer.tin'

This script relies on an #EVENT {PROGRAM START} in order to create
the 'roomnameheader' file in your home directory of linux, when TinTin first launches.

You must launch TinTin like the example above in order to trigger
the creation of this file! Of course, after you launch tintin++ using the original file, you can
then save your new MUD session under
a different filename and launch tintin++ using your new save file instead.

************************************************************************



Description of the 3 major commands this script uses:

mapon - This command turn on automatic room name writes.

This command automatically filters out the first line of text when you move
in a new direction, from the 'tinlog' file using 'sed'. 'cat' then
merges the filtered room name from 'tinlog' file, with the text in the 'roomnameheader' file and then
stores the final output as a TinTin++ #VARIABLE. #MAP then calls the variable
and writes in the roomname automatically!

mapoff - This command turn off automatic room name writes.

Disables automatic writing of roomname descriptors using the
{#MAP flag static on} command. You will want to use 'mapoff' when speed-
walking!!! The 'mapon' script takes 0.33 seconds to finish executing.
Wait half a second before moving in a new direction with 'mapon' enabled!!!

zone - This command writes into #MAP whatever you have zone currently set as. It does this
each time you move in a new direction, but only if 'mapon' is enabled. It does not write anything if 'mapoff' is enabled.

Example usage: zone Name Of Area

Zone command updates the ${roomarea} variable to whatever you manually update the zone command to be set as.
The 'mapon' command automatically reads the 'roomarea' variable and adds it into
#MAP each time you move. Type 'rinfo' or '#MAP info' to view room descriptor information.

You must update 'zone' manually as you move into a new zone!!!! Otherwise, if mapon is enabled, zone will overwrite
your old zone information!


--------------------------------------------------------------------------


Secondary #MAP commands to make things a little easier. Area, note, and room names are
Case Sensitive!!! The < > symbols need to be removed and just make things easier to read.

delroom <direction> - Deletes a room in the given direction, and all rooms that come before it!!!

listarea <area name> - Lists all rooms in the given area.

listnote <note name> - Lists all rooms that have this note name.

listroom <room name> - Lists all rooms that have this room name.

findarea <area name> - Plots the shortest path and displays how to get there.

findnote <note name> - Plots the shortest path and displays how to get there.

findroom <room name or room number> - Plots the shortest path and displays how to get there.

goto <room name or room number> - Moves #MAP, but not your MUD character, to the given room.

note <note name> - Adds note information to a room.

rinfo - Displays all room descriptor information about the current room you're in.

symbol <$ @ & A B C> - Marks a room on the map with a symbol. ( $ @ & A B C )

undo - Moves #MAP back one room and deletes a newely created room, if one was created.

walk - Walk the path plotted by 'findroom' one step at a time.


For further information on all commands, read '#help map' in TinTin++ .


-----------------------------------------------------------------------------------


If you want a minimap that shows your mapping progress in real-time,
type this in seperate terminal window...

tail -fs 0.1 ~/map.txt


You will probably need to adjust the '#VARIABLE {refresh.minimap} 40x12' numbers
to get the map to line up correctly. I have my minimap in a small window in the top
righthand corner of my screen.

40 moves map left and right, higher numbers moves map to the right
12 moves map up and down, lower numbers moves map down



If you need to filter out a different text line for the roomname.
Change the '1 p' parameter of 'sed' to '3 p' to filter out line 3rd line of text from the MUD's output.


If the room names fail to write into #MAP, it's probably due to the MUD server taking too long to reply.

Try increasing the '#delay' timers in the mapon script. Change 'delay 0.3' to 'delay 1.0' for a one second delay.
Do the same for the two other times, but make sure the last timer (0.33) has a longer timeout than the first two timers.
Something like 'delay 1.1' should work.


--------------------------------------------------------------------------------


*Updates added - 04/25/2013*

changed - the way 'mapon' 'mapoff' calls '#MAP flag static'. They now use '#MAP flag static {off/on}'

changed - 'mapon' script from an #ALIAS to an '#EVENT {MAP ENTER ROOM}'

added - more mapping aliases to make things easier for beginners

added - green #ECHO messages to confirm user input on some commands

added - ${refresh.minimap} #VARIABLE that makes adjusting the minimap location easier. Simply
change '#VARIABLE {refresh.minimap}' to a new value and the changes take effect across
all #ALIASES and #EVENTS that have ${refresh.minimap} in them.

added - ${refresh.minimap} to some of the map editing #ALIASES. This allows the minimap to update
immediately after a map edit command is executed. Minimap needs to be run in a seperate terminal
window from TinTin. Type this in seperate terminal window, tail -fs 0.1 ~/map.txt



*Updates added - 10/08/2013*

added - Changed some wording in this post to make the instructions a little easier to understand.

added - Included a copy of this script in the post below, in case the download link goes dead.
You'll have to copy and paste the script into a text file. Then launch tintin++ using the example at the top of this post.


#END


Last edited by Pokaku on Fri Nov 01, 2013 1:32 am; edited 8 times in total
Back to top
View user's profile Send private message
Pokaku



Joined: 23 Apr 2013
Posts: 3

PostPosted: Tue Oct 08, 2013 1:53 am    Post subject: Reply with quote

Code:
#ALIAS {delroom}
{
   #map delete %0;
   ${refresh.minimap}
}
{5}

#ALIAS {findarea}
{
   #map find {} {} {} {%0} {};
   #path show
}
{5}

#ALIAS {findnote}
{
   #map find {} {} {} {} {%0};
   #path show
}
{5}

#ALIAS {findroom}
{
   #map find {%0} {} {} {} {};
   #path show
}
{5}

#ALIAS {goto}
{
   #map goto %0;
   ${refresh.minimap}
}
{5}

#ALIAS {listarea}
{
   #map list {} {} {} {%0} {} {}
}
{5}

#ALIAS {listnote}
{
   #map list {} {} {} {} {%0} {}
}
{5}

#ALIAS {listroom}
{
   #map list {%0} {} {} {} {} {}
}
{5}

#ALIAS {mapoff}
{
   #event {MAP ENTER ROOM} {${refresh.minimap}};
   #map {flag} {static} {on};
   #echo {Room writes disabled!}
}
{5}

#ALIAS {mapon}
{
   #event {MAP ENTER ROOM} {#log {overwrite} tinlog;#map set roomarea ${roomarea};#delay {0.3} {#SCRIPT {sed -u -n '1 p' <~/tinlog | cat ~/roomnameheader -}};#DELAY {0.3} {#LOG {off}};#DELAY {0.33} {#MAP name ${roomname}};${refresh.minimap}};
   #echo {Mapping enabled! Room Area = <229>${roomarea}<099>. Update with 'zone' command.};
   #map {flag} {static} {off}
}
{5}

#ALIAS {note}
{
   #map set roomnote %0;
   #echo {RoomNote = <229>%0}
}
{5}

#ALIAS {rinfo}
{
   #map info
}
{5}

#ALIAS {symbol}
{
   #map set roomsymbol %0;
   #echo {RoomSymbol = <229>%0}
}
{5}

#ALIAS {undo}
{
   #map undo;
   ${refresh.minimap}
}
{5}

#ALIAS {walk}
{
   #path walk
}
{5}

#ALIAS {zone}
{
   #variable {roomarea} {%0};
   #echo {Zone set to:<229> ${roomarea}}
}
{5}

#CONFIG           {256 COLORS}  {ON}
#CONFIG           {AUTO TAB}  {5000}
#CONFIG           {BUFFER SIZE}  {20000}
#CONFIG           {CHARSET}  {ASCII}
#CONFIG           {COMMAND COLOR}  {<078>}
#CONFIG           {COMMAND ECHO}  {ON}
#CONFIG           {CONNECT RETRY}  {15}
#CONFIG           {HISTORY SIZE}  {1000}
#CONFIG           {LOG}  {PLAIN}
#CONFIG           {PACKET PATCH}  {0.00}
#CONFIG           {REPEAT CHAR}  {!}
#CONFIG           {REPEAT ENTER}  {OFF}
#CONFIG           {SCROLL LOCK}  {ON}
#CONFIG           {SPEEDWALK}  {OFF}
#CONFIG           {TINTIN CHAR}  {#}
#CONFIG           {VERBATIM}  {OFF}
#CONFIG           {VERBATIM CHAR}  {\}
#CONFIG           {VERBOSE}  {OFF}
#CONFIG           {WORDWRAP}  {ON}
#EVENT {MAP ENTER ROOM}
{
   ${refresh.minimap}
}

#EVENT {PROGRAM START}
{
   #script {touch ~/roomnameheader && echo -n '#VARIABLE {roomname} ' >~/roomnameheader}
}

#PATHDIR          {d}  {u}  {32}
#PATHDIR          {e}  {w}  {2}
#PATHDIR          {n}  {s}  {1}
#PATHDIR          {ne}  {sw}  {3}
#PATHDIR          {nw}  {se}  {9}
#PATHDIR          {s}  {n}  {4}
#PATHDIR          {se}  {nw}  {6}
#PATHDIR          {sw}  {ne}  {12}
#PATHDIR          {u}  {d}  {16}
#PATHDIR          {w}  {e}  {8}
#VARIABLE         {refresh.minimap}  {#MAP {map} {40x12} {map.txt} {a}}
#VARIABLE         {result}  {}
#VARIABLE         {roomarea}  {}
#VARIABLE         {roomname}  {}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group