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

How to make status window?

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
steven



Joined: 22 May 2011
Posts: 24

PostPosted: Thu May 26, 2011 8:05 am    Post subject: How to make status window? Reply with quote

Hi there

I am a mac user and using the precompiled 2.0.0.6 version.

I used zmud before, and it has a feature that can create an empty window, and let me put variables inside. So that I can arrange and forma my status just like inside mud. I set a trigger to update the variable and I don't need to trace the mud output @@" frequently.

I guess there should be a way for tt++ to do similar thing, something like #format, #log or #write to a file and I use tail -f status.log to get the result.

Can anybody give some hints?

Below is a sample format that I would like to have:

Code:

 Mana  :  201/  201 (100%)    Magic:  145 /  145 (+0)
 HP  :  127/  127 (100%)      Power:    2 /    1 (+0)
 Food:  263/  370 [normal]       Pot:   10 /  103
 Water:  263/  370 [normal]      Exp: 1698


Thanks!
Back to top
View user's profile Send private message
curist



Joined: 22 Sep 2010
Posts: 22

PostPosted: Thu May 26, 2011 8:40 am    Post subject: Reply with quote

the best way to achieve this might be using tmux.
though something like #split 6 1 could do,
but using tmux is just more flexible for the layout

I've done some configuration using tmux with several panes(tmux terms for splited windows), each panes running tail -f chat.log, or other tt++ session,
and use netcat for communication between tt++, sending char status etc.

have fun tinkering!! Coffee

..

ah..

or are you simply looking for
#line log {/path/to/the/filename}{strings to be logged};
Back to top
View user's profile Send private message
steven



Joined: 22 May 2011
Posts: 24

PostPosted: Thu May 26, 2011 10:04 am    Post subject: Reply with quote

Hi Curist

Thanks for your help, but the one i am looking for should be similar to the right window in the following screenshot:
http://imageshack.us/f/442/zmud.jpg/

or the one at the bottom right:
http://img202.imageshack.us/img202/6328/aardmushscreen.png

Zmud allow users to put variables into the window, and do whatever custom formatting as desired, just like opening a notepad, and put several variables inside.

#line log only write one line of text, but I would like my variables to spread over several lines, and formatted properly.

Any method to achieve that effect using tt? Maybe I am too picky, but having a status window instead of a prompt will be more handy to me.


I am now using several terminal windows by using "window group". :p

Just for your reference, mac users can also use "screen". For "linux" user, I would suggest "terminator"~
Back to top
View user's profile Send private message
curist



Joined: 22 Sep 2010
Posts: 22

PostPosted: Thu May 26, 2011 11:58 am    Post subject: Reply with quote

ok.. so I hadn't overly replying your question.
tmux is similiar to screen, but with more powerful vertical split capability.
screen will do the job too, but screen will lose its layout after detach and reattach the session.

here goes my screenshot, I havn't made my mind to design the top right pane btw. (which should be what you are looking for, more character details)
http://imageshack.us/photo/my-images/703/screenshot1qii.png/

will post some scripts if you're interested
Back to top
View user's profile Send private message
steven



Joined: 22 May 2011
Posts: 24

PostPosted: Thu May 26, 2011 12:50 pm    Post subject: Reply with quote

Curist

Really thanks for your help again~ I will try to figure out if it is possible to make a status window just like zmud do. Will update you my scripts~~

Cheers! Ecstatic
Back to top
View user's profile Send private message
steven



Joined: 22 May 2011
Posts: 24

PostPosted: Thu May 26, 2011 8:24 pm    Post subject: Reply with quote

Hi Curist

By the way, how do u make the top right pane? The one with level 101 labeled. Is it loaded from a separate file?

Cheers
Back to top
View user's profile Send private message
curist



Joined: 22 Sep 2010
Posts: 22

PostPosted: Fri May 27, 2011 7:18 am    Post subject: Reply with quote

steven wrote:
Hi Curist

By the way, how do u make the top right pane? The one with level 101 labeled. Is it loaded from a separate file?

Cheers


I'm running a tintin++ there, and for the top right pane, lets call it vital bars session,
both the vital bars session and the main playing window are running netcat for communication.
for the main, I have
Code:
#run nc_vitals {nc -l 9082};

and for the vital session, as you might guessed, running
Code:
#run nc {nc 127.0.0.1 9082};



and for actually showing the content, there are two methods i'm aware of,
one is using a #ticker, say display the content every 1 second.
one is renew the display upon new data received, and you renew the whole display again.

also check the combination of
Code:
#split 10 0;
#show {hi there!!}{-3}

by using this, you can refresh only the line have data changed,
which could help if you're having display flickering issue.

oh, one more thing, I'm considering replace netcat with socat, with socat,
Code:
socat tcp-listen:9000,bind=127.0.0.1,fork -

this would make things easier, and no security issue to be concerned.

best luck
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Fri May 27, 2011 6:45 pm    Post subject: Reply with quote

That looks pretty good.

How exactly are you using netcat?

Typically people people use tail -f <filename> and log to the file to update status windows.
Back to top
View user's profile Send private message Send e-mail
curist



Joined: 22 Sep 2010
Posts: 22

PostPosted: Fri May 27, 2011 9:47 pm    Post subject: Reply with quote

IMO, tail -f is ok for chat logs, chat log doesn't need instant refresh,
some delays are tolerable.

By using netcat, let the main tintin++ be A, the target tintin++ to be B;
In A
Code:
#run nc_vitals {nc -l 9082};

In B
Code:
#run nc {nc 127.0.0.1 9082};


and when A received new data in some playing session #FOO,
do something like... ahh.. forget it, lets see the real script
Code:
#run nc {nc 127.0.0.1 9082};
#gts #sp 3 0;
#var BARLEN 20;
#var LV 1;
#var HP 20;
#var MAXHP 20;
#var MP 20;
#var MAXMP 20;
#var MV 20;
#var MAXMV 20;
#var XP 20;
#var MAXXP 20;

#tic showbar
{
    #gts #show {<119>Level <139>$LV<099>                   } {-1};
    #script {BAR} {lua -e 'left = $HP;max = $MAXHP;leftbar = $BARLEN * left / max;rightbar = $BARLEN - leftbar;print(string.rep("|",leftbar) .. "\n" .. string.rep("|",rightbar))'};
    #gts #show { <179>HP  <119>[<129>$BAR[1]<109>$BAR[2]<119>]<099>} {-2};
    #script {BAR} {lua -e 'left = $MP;max = $MAXMP;leftbar = $BARLEN * left / max;rightbar = $BARLEN - leftbar;print(string.rep("|",leftbar) .. "\n" .. string.rep("|",rightbar))'};
    #gts #show { <179>MP  <119>[<149>$BAR[1]<109>$BAR[2]<119>]<099>} {-3};
    #script {BAR} {lua -e 'left = $MV;max = $MAXMV;leftbar = $BARLEN * left / max;rightbar = $BARLEN - leftbar;print(string.rep("|",leftbar) .. "\n" .. string.rep("|",rightbar))'};
    #gts #show { <179>MV  <119>[<169>$BAR[1]<109>$BAR[2]<119>]<099>} 1;
    #script {BAR} {lua -e 'left = $XP;max = $MAXXP;rightbar = $BARLEN * left / max;leftbar = $BARLEN - rightbar;print(string.rep("|",leftbar) .. "\n" .. string.rep("|",rightbar))'};
    #gts #show { <179>EXP <119>[<139>$BAR[1]<109>$BAR[2]<119>]<099>} 0;
} {1};

#act {^MAX %1 %2 %3 %4}
{
    #var MAXHP %1;
    #var MAXMP %2;
    #var MAXMV %3;
    #var MAXXP %4;
};

#act {^REFRESH %1 %2 %3 %4 %5}
{
    #var HP %1;
    #var MP %2;
    #var MV %3;
    #var XP %4;
    #var LV %5;
    #nop
    {
        #if {%1 > $MAXHP}
        {
            #var MAXHP %1;
        };
        #if {%2 > $MAXMP}
        {
            #var MAXMP %2;
        };
        #if {%3 > $MAXMV}
        {
            #var MAXMV %3;
        };
        #if {%4 > $MAXXP}
        {
            #var MAXXP %4;
        };

    };

};

#gts;
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Fri May 27, 2011 11:10 pm    Post subject: Reply with quote

That's nifty, looks like you can telnet straight to it with tintin by using:

Code:

#run nc_vitals {nc -lp 9082}

#ses tt_vitals localhost 9082


If you wanna do bars in tintin rather than lua you could do:

Code:

#var BARLEN 20;
#var HP 20;
#var MAXHP 20;

#function {math} {#math result %0}

#format {BAR[1]} {%.@math{$HP * $BARLEN / $MAXHP}s} {||||||||||||||||||||}
#format {BAR[2]} {%.@math{$BARLEN - $HP * $BARLEN / $MAXHP}s} {||||||||||||||||||||}
#gts #show { <179>HP  <119>[<129>$BAR[1]<109>$BAR[2]<119>]<099>} {-2};
Back to top
View user's profile Send private message Send e-mail
curist



Joined: 22 Sep 2010
Posts: 22

PostPosted: Sat May 28, 2011 2:20 am    Post subject: Reply with quote

whoa..it seems like im too used to netcat on both peers.
and for the bar, I think I tried
Code:
#format {BAR[1]} {%.*s}{$len}{|||||||||||||||||||||||||}

never thought of using #format like that

thx for the tips Big Smile
Back to top
View user's profile Send private message
steven



Joined: 22 May 2011
Posts: 24

PostPosted: Sun May 29, 2011 12:15 pm    Post subject: Finally I got it~ Reply with quote

Dear Both

Finally I got what I want, by putting all the required info into #format variable, and then use #line {log} {filename} {format variable}:

Code:

#class stwindow open
#act {^≡───────────────────── 香港俠客行「屯門站」 ─≡$} {
  #format {jingbar} { 精:%+7s/%+s(%d%s)   精力:%d/%d(+%d)\n} {$jing[jing]} {$jing[maxjing]} {$jing[perjing]} {%} {$jingli[jingli]} {$jingli[maxjingli]} {$jingli[perjingli]};
  #format {qibar} {氣:%+7s/%s(%d%s)   內力:%d/%d(+%d)\n} {$qi[qi]} {$qi[maxqi]} {$qi[perqi]} {%} {$neili[neili]} {$neili[maxneili]} {$neili[jiali]};
  #format {foodbar} {食物:  %d/%d[%s]   潛能:%d/%d\n} {$food[food]} {$food[maxfood]} {$food[status]} {$pot[pot]} {$pot[maxpot]};
  #format {waterbar} {飲水:  %d/%d[%s]   經驗:%g\n} {$water[water]} {$water[maxwater]} {$water[status]} {$exp};

  #line {log} {tmp/stwindow.log} {
    $jingbar
    $qibar
    $foodbar
    $waterbar
  }
}
#class stwindow close


and the output:
Code:

 精:    345/345(100%)   精力:280/280(+0)
 氣:    174/317(100%)   內力:563/453(+0)
 食物:  412/370[很飽]    潛能:10/109
 飲水:  392/370[很滿]    經驗:4,482



Cheers~

by the way, I use {%s} as a placeholder for this "%" symbol. In PHP, I can use %% to escape %, but how can I do that in tt??
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun May 29, 2011 9:37 pm    Post subject: Reply with quote

Using %% should work as well.
Back to top
View user's profile Send private message Send e-mail
steven



Joined: 22 May 2011
Posts: 24

PostPosted: Sun May 29, 2011 11:54 pm    Post subject: Reply with quote

Scandum wrote:
Using %% should work as well.


Oh, I forgot to metion, using %% , the "%" didn't show, and also
the word "精力" become "精山". Maybe some weird big5 issue?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Mon May 30, 2011 10:04 am    Post subject: Reply with quote

Could be a big5 related, I'll look into it.

Not sure why %% isn't working for you. Using a simple test case it works for me:

#format test {%+5s%%} {100}
Back to top
View user's profile Send private message Send e-mail
steven



Joined: 22 May 2011
Posts: 24

PostPosted: Mon May 30, 2011 10:12 am    Post subject: Reply with quote

Scandum wrote:
Could be a big5 related, I'll look into it.

Not sure why %% isn't working for you. Using a simple test case it works for me:

#format test {%+5s%%} {100}


I will try the new 2.00.7 beta and let you know the result!
Back to top
View user's profile Send private message
hzopak



Joined: 31 May 2011
Posts: 1

PostPosted: Tue May 31, 2011 8:46 am    Post subject: Reply with quote

Hey curist,

Great set up there.

I was wondering how you managed to capture the minimap data?

Do you have a website where you upload your scripts? I'd like to learn from them.
Back to top
View user's profile Send private message
Chicomecoatl



Joined: 08 Sep 2009
Posts: 73
Location: Kansas

PostPosted: Tue May 31, 2011 7:36 pm    Post subject: Reply with quote

I'm unable to speak for curist, but I have an Aardwolf setup as well. And i capture the minimap by turning on the 'capture' trigger when i reciever the <MAPSTART> tag, and turn it back off when it recieves the <MAPEND> tag.

This allows you to capture it, log it to a file, and then fail in another window.
_________________
Chico
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue May 31, 2011 10:54 pm    Post subject: Reply with quote

I wrote a GMCP automapper once that might work with Aardwolf:

http://tintin.sourceforge.net/board/viewtopic.php?p=4651

#map flag vtmap would be the easiest for displaying, another option is using the MAP ENTER ROOM event to execute something like: #map map {20x10} {map.txt} {a} and tail it in a mini window.

More info here: http://www.aardwolf.com/wiki/index.php/Clients/GMCP
Back to top
View user's profile Send private message Send e-mail
curist



Joined: 22 Sep 2010
Posts: 22

PostPosted: Fri Jun 03, 2011 1:01 pm    Post subject: Reply with quote

hi guys, sorry for the late reply.
I would love to share my scripts, there are pretty much hard coded stuff,
sorry for that..
I have a bash alias as
Code:
aard='sh ~/Games/mud/aardwolf/aard.tmux'

and the rest are all in the .tar.gz file..
http://www.multiupload.com/MKWC5YXB1H

I think the mapping.tt is simply copy/paste from Scandum's GMCP automapper script Blink
Back to top
View user's profile Send private message
Chicomecoatl



Joined: 08 Sep 2009
Posts: 73
Location: Kansas

PostPosted: Tue Jun 07, 2011 11:04 pm    Post subject: Reply with quote

I have a very in depth mapper script based on Aardwolf GMCP, that also comes with ways to find the shortest path to anywhere on the mud that you've been at least once, utilizing clan exits, portals, etc. As well as a runto redo to find the shortest path to the first room of the area. Unfortunately, you have to use the alias, if it doesn't 'know' the first room, it will run you to it, and then flag it as the first room for later reference.

I'm willing to share this for anyone who's looking for it, if so send me a tell on Aardowolf to cheezburger, and i'll see what i can do.
_________________
Chico
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
dandenison84



Joined: 30 Dec 2011
Posts: 40

PostPosted: Thu Feb 09, 2012 6:43 am    Post subject: Reply with quote

curist wrote:
hi guys, sorry for the late reply.
I would love to share my scripts, there are pretty much hard coded stuff,
sorry for that..
I have a bash alias as
Code:
aard='sh ~/Games/mud/aardwolf/aard.tmux'

and the rest are all in the .tar.gz file..
http://www.multiupload.com/MKWC5YXB1H

I think the mapping.tt is simply copy/paste from Scandum's GMCP automapper script Blink


Sorry for the old bump, but this download doesn't work any longer. i'm interested in looking at the tmux setups given. Can anyone help?
Back to top
View user's profile Send private message Send e-mail
dalton



Joined: 26 Jan 2012
Posts: 30

PostPosted: Thu Feb 09, 2012 8:49 am    Post subject: Reply with quote

I have,but how give it to you ?
Back to top
View user's profile Send private message
dandenison84



Joined: 30 Dec 2011
Posts: 40

PostPosted: Fri Feb 10, 2012 6:15 am    Post subject: Reply with quote

PM sent.
Back to top
View user's profile Send private message Send e-mail
ixle



Joined: 15 Sep 2011
Posts: 158
Location: United States

PostPosted: Sun Feb 12, 2012 3:27 am    Post subject: Reply with quote

I've used both Curists settings and Chicomecoatls settings and have something public for download for Aardwolf. They both get credit for all this as I haven't done much but tweak it, document it (some), and host it. I never found a reason to use netcat, tail -fs .1 <filename> gives virtually instant refreshing.

Check out http://theixle.dyndns.org and see if you that helps you out.

The 'tmuxit' file is a bash script that will have to be customized to your setup but should provide a good example of how to automate the pane splitting.

Cheers.
Back to top
View user's profile Send private message
dandenison84



Joined: 30 Dec 2011
Posts: 40

PostPosted: Mon Feb 13, 2012 6:31 am    Post subject: Reply with quote

Thanks a bunch, that should help get me started.
Back to top
View user's profile Send private message Send e-mail
obazavil



Joined: 21 Jan 2008
Posts: 4

PostPosted: Thu Mar 29, 2012 11:42 am    Post subject: Reply with quote

curist wrote:
hi guys, sorry for the late reply.
I would love to share my scripts, there are pretty much hard coded stuff,
sorry for that..
I have a bash alias as
Code:
aard='sh ~/Games/mud/aardwolf/aard.tmux'

and the rest are all in the .tar.gz file..
http://www.multiupload.com/MKWC5YXB1H

I think the mapping.tt is simply copy/paste from Scandum's GMCP automapper script Blink


Hi!

I can't connect to multiupload...

any1 can upload those files somewhere else? (mediafire, etc...)

thanks!
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 -> Script Help 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