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

Aardwolf GMCP automapper

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


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sun Oct 30, 2011 10:46 pm    Post subject: Aardwolf GMCP automapper Reply with quote

This script will enable automapping and a status bar using GMCP. The GMCP documentation for Aardwolf is available here:

http://www.aardwolf.com/wiki/index.php/Clients/GMCP

Keep in mind that the TinTin++ event handler is case sensitive (this can't be easily fixed), so this stuff won't work for IRE without changing the capitalization of the GMCP events.

Code:

#format IAC  %a 255
#format DONT %a 254
#format DO   %a 253
#format WONT %a 252
#format WILL %a 251
#format SB   %a 250
#format SE   %a 240

#format GMCP %a 201

#nop Turn telnet debug off once everything works as it's spammy.

#config {debug telnet} {off}

#var CLIENT_NAME TinTin++
#var CLIENT_VERSION 2.00.3

#nop Translation table to handle implementation differences.

#var {DIR_NAME}
{
        {n} {N}
        {e} {E}
        {s} {S}
        {w} {W}
        {u} {U}
        {d} {D}
        {north} {N}
        {east} {E}
        {south} {S}
        {west} {W}
        {up} {U}
        {down} {D}
}

#nop Utility function to generate color gradients, requires 256 color terminal.

#function {colscale}
{
        #switch {10 * %1 / %2}
        {
                #case {0} {#return <faa>};
                #case {1} {#return <fba>};
                #case {2} {#return <fca>};
                #case {3} {#return <fda>};
                #case {4} {#return <fea>};
                #case {5} {#return <ffa>};
                #case {6} {#return <efa>};
                #case {7} {#return <dfa>};
                #case {8} {#return <cfa>};
                #case {9} {#return <bfa>};
                #default  {#return <afa>}
        }
}

#event {PROGRAM START}
{
        #var CLIENT_NAME %0;
        #var CLIENT_VERSION %1
}

#event {IAC WILL GMCP}
{
        #send {$IAC$DO$GMCP\};
        #send {$IAC$SB$GMCP core.hello { "client": "$CLIENT_NAME", "version": "$CLIENT_VERSION" } $IAC$SE\};
        #send {$IAC$SB$GMCP core.supports.set [ "room 1", "room.info 1", "char 1", "char.status 1" ] $IAC$SE\}
}

#event {IAC SB GMCP char.status IAC SE}
{
        #var gmcp[char][status] {%0}
}

#event {IAC SB GMCP char.base IAC SE}
{
        #var gmcp[char][base] {%0}
}

#event {IAC SB GMCP char.vitals IAC SE}
{
        #var gmcp[char][vitals] {%0}
}

#event {IAC SB GMCP char.maxstats IAC SE}
{
        #var gmcp[char][maxstats] {%0}
}

#event {IAC SB GMCP char.worth IAC SE}
{
        #var gmcp[char][worth] {%0}
}

#tick {prompt_update}
{
        #if {&gmcp[char][] != 5}
        {
                #return
        };

        #format {prompt} {};

        #format {prompt} {$prompt<038> Hp: @colscale{$gmcp[char][vitals][hp];$gmcp[char][maxstats][maxhp]}%+4s<238>/<138>%-4s } {$gmcp[char][vitals][hp]} {$gmcp[char][maxstats][maxhp]};
        #format {prompt} {$prompt<238> Mn: @colscale{$gmcp[char][vitals][mana];$gmcp[char][maxstats][maxmana]}%+3s<238>/<138>%-3s } {$gmcp[char][vitals][hp]} {$gmcp[char][maxstats][maxmana]};
        #format {prompt} {$prompt<238> Mv: @colscale{$gmcp[char][vitals][moves];$gmcp[char][maxstats][maxmoves]}%+3s<238>/<138>%-3s } {$gmcp[char][vitals][moves]} {$gmcp[char][maxstats][maxmoves]};
        #format {prompt} {$prompt<238> Xp: @colscale{$gmcp[char][status][tnl];1000}%-3m } {100 * $gmcp[char][status][tnl] / 1000};
        #format {prompt} {$prompt<238> Gd: <128>%-8s } {$gmcp[char][worth][gold]};

        #var exits {};

        #foreach {n;north;e;east;s;south;w;west;u;up;d;down} {exit}
        {
                #if {&gmcp[room][info][exits][$exit] == 0}
                {
                        #continue
                };

                #var {exits} {$exits<128>$DIR_NAME[$exit]}
        };
        #format {prompt} {$prompt <238>Ex: %-6s} {$exits   <088>};

        #line ignore #showme {$prompt} {1}
}
{1}

#event {IAC SB GMCP room.info IAC SE}
{
        #var gmcp[room][info] {%0};

        #if {$gmcp[room][info][num] == -1}
        {
                #return
        };

        #map goto {$gmcp[room][info][num]} {dig};

        #map get roomarea {result};

        #if {"$result" == ""}
        {
                #map set roomarea $gmcp[room][info][zone];
                #map set roomnote $gmcp[room][info][environment];
                #map set roomname $gmcp[room][info][name];
                #map set roomterr $gmcp[room][info][terrain];
                #map set roominfo $gmcp[room][info][details];
                #map set roomcolor <178>
        };

        #foreach {$gmcp[room][info][exits][]} {exit}
        {
                #map get {roomexit} {result};

                #if {&result[$exit] == 0}
                {
                        #map get {roomvnum} {result} {$gmcp[room][info][exits][$exit]};

                        #map dig {$exit} {$gmcp[room][info][exits][$exit]};

                        #if {$result == 0}
                        {
                                #map set {roomcolor} {<fca>} {$gmcp[room][info][exits][$exit]}
                        }
                }
        }

}

#event {SESSION CONNECTED}
{
        #split 16 1;
        #map create 100000;
        #map goto 1;
        #map flag vtmap;
        #map flag static;
        #map flag nofollow;
        #map read gmcp.map
}

#event {SESSION DISCONNECTED}
{
        #map write gmcp.map
}
Back to top
View user's profile Send private message Send e-mail
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