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

Simple Map Display

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



Joined: 12 Dec 2007
Posts: 165

PostPosted: Fri Oct 03, 2014 7:15 pm    Post subject: Simple Map Display Reply with quote

I wasn't getting good behavior out of tailing my map file, so I wrote a small bash script that does exactly what I want:

Code:
#!/usr/bin/env bash

MAP_FILE='map.txt'
MAP_SIZE='map_size.tin'
REFRESH_RATE=.25

while [ "true" ]; do
    echo \#var MAP_ROWS $(tput cols)\; > $MAP_SIZE
    echo \#var MAP_LINES $(tput lines)\; >> $MAP_SIZE
    clear
    cat $MAP_FILE
    sleep $REFRESH_RATE
done


It writes the number of columns and lines in the map display window to a tintin file, which can then be read by the map event, that way the map is always written in an optimized size for the window:

Code:
#event {MAP ENTER ROOM} {
    #read map_size.tin;
    #map map ${MAP_ROWS}x${MAP_LINES} map.txt;
};


I saw a couple posts where people were having trouble with tail, so I thought I'd share.
Back to top
View user's profile Send private message AIM Address
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