tintin++ config file with combat code and other tweeks

Started by nauta, January 10, 2016, 12:47:32 PM

Hi,

Any regular expression gurus out there want to help me with a small project?  I'm trying to implement the bolded opponent thing client-side, and I've probably not had enough coffee.

Here's what I want:
Quote
The vicious, sexy, and tall muscular man chops at you.

(Among other things.)

So, I thought I'd try this:

#action {{%*} chops at you.} {
  #substitute {%1} {<170>%1};
}


But for some reason this doesn't work as expected.  It bright whites the entire line.

Any thoughts?  Here's the reference:

http://tintin.sourceforge.net/manual/action.php
as IF you didn't just have them unconscious, naked, and helpless in the street 4 minutes ago

Hehe, figured it out.


#action {%* attacks you.} {
  #substitute {%1} {<170>%1<099>};
}


Thanks coffee!
as IF you didn't just have them unconscious, naked, and helpless in the street 4 minutes ago

It's a WIP, but the following is an outline for getting the brighted opponent during combat -- I'll update as I go along.  This was more a Proof-of-Concept for me, but it works!  (I'm missing some attack types.)


#substitute {%1 {attacks you.}} {
  <150>%1<099> %2
}

#substitute {%1 {reels from the blow.}} {
  <150>%1<099> %2
}

#substitute {%1 {lunges at you}%3} {
<150>%1<099> %2%3
}

#substitute {%1 {swiftly dodges your}%3} {
<150>%1<099> %2%3
}

#substitute {%1 {parries your}%3} {
<150>%1<099> %2%3
}

#substitute {%1 {slides away from your mount}%3} {
<150>%1<099> %2%3
}

#substitute {%1 {lightly|solidly} {gores|claws|pecks|hits|chops|slashes|pierces} {at you|your|you}%5} {
<150>%1<099> %2 %3 %4%5
}

#substitute {%1 {gores|claws|pecks|hits|chops|slashes|pierces} {at you|your|you}%4} {
<150>%1<099> %2 %3%4
}

#substitute {{You} {viciously|lightly|solidly} {nick|slash|chop|hit|pierce} %4{'s} %6} {
  %1 %2 %3 <150>%4<099>%5 %6
}

#substitute {{You} {nick|slash|chop|hit|pierce} %3{'s} %5} {
%1 %2 <150>%3<099>%4 %5
}

#substitute {{You} {viciously|lightly|solidly} {nick|slash|chop|hit|pierce} %4 {very|on}} {
%1 %2 %3 <150>%4<099> %5
}

#substitute {{You} {nick|slash|chop|hit|pierce} %3 {very|on}} {
%1 %2 <150>%3<099> %4
}

#substitute {{You inflict a grievous wound on} %2{'s} %4} {
  %1 <150>%2<099>%3 %4
}

#substitute {{You land a solid chop to} %2{'s} %4} {
  %1 <150>%2<099>%3 %4
}

#substitute {{You wound} %2 {on} %4} {
  %1 <150>%2<099> %3 %4


#substitute {{You charge at} %2} {
  %1 <150>%2<099>
}

#substitute {{You attack} %2} {
  %1 <150>%2<099>
}

#substitute {{You deftly parry} %2{'s attack.}} {
  %1 <150>%2<099>%3
}

as IF you didn't just have them unconscious, naked, and helpless in the street 4 minutes ago

Here's an updated version that has worked for me over the last few weeks.  It seeks to emulate the 'old' behavior of color highlighting certain bits of text during combat (notably: who your opponent is).


#substitute {%1 {attacks you.}} {
  <150>%1<099> %2
}

#substitute {%1 {lightly|solidly|brutally|viciously} {gores|bites|claws|pecks|hits|chops|stings|stabs|whips|pinches|bludgeons|slashes|pierces} {at you|your|you}%5} {
<150>%1<099> %2 <170>%3<099> %4%5
}

#substitute {%1 {gores|bites|claws|pecks|hits|chops|stings|stabs|whips|pinches|bludgeons|slashes|pierces} {your|you}%4} {
<150>%1<099> <170>%2<099> %3%4
}

#substitute {%1 {gores|bites|claws|pecks|hits|chops|stings|stabs|whips|pinches|bludgeons|slashes|pierces} %3{'s|, barely} %5} {
<150>%1<099> <170>%2<099> <150>%3<099>%4 %5
}

#substitute {%1 {lightly|solidly|brutally|viciously} {gores|bites|claws|pecks|hits|chops|stings|stabs|whips|pinches|bludgeons|slashes|pierces} %4 on %6} {
<150>%1<099> <170>%2 %3<099> <150>%4<099> on %6
}

#substitute {%1 {gores|bites|claws|pecks|hits|chops|stings|stabs|whips|pinches|bludgeons|slashes|pierces} %3 on %5} {
<150>%1<099> <170>%2<099> <150>%3<099> on %5
}

#substitute {{You} {lightly|solidly|brutally|viciously} {nick|slash|chop|stab|whip|bludgeon|hit|pierce} %4{'s} %6} {
  %1 %2 %3 <150>%4<099>%5 %6
}

#substitute {{You} {nick|slash|chop|stab|whip|bludgeon|hit|pierce} %3{'s} %5} {
%1 %2 <150>%3<099>%4 %5
}

#substitute {{You} {lightly|solidly|brutally|viciously} {nick|slash|chop|stab|whip|bludgeon|hit|pierce} %4 {very|on}} {
%1 %2 %3 <150>%4<099> %5
}

#substitute {{You} {nick|slash|chop|stab|whip|bludgeon|hit|pierce} %3{, barely| very| on}} {
  %1 %2 <150>%3<099>%4
}

#substitute {{You inflict a grievous wound on} %2{'s} %4} {
  %1 <150>%2<099>%3 %4
}

#substitute {{You wound} %2 {on} %4} {
  %1 <150>%2<099> %3 %4
}

#substitute {{You do unspeakable damage to} %2{'s} %4} {
  %1 <150>%2<099>%3 %4

}
#substitute {{You land a solid} {nick|slash|chop|stab|whip|bludgeon|hit|pierce} {to} %4{'s} %6} {
  %1 %2 %3 <150>%4<099>%5 %6
}
as IF you didn't just have them unconscious, naked, and helpless in the street 4 minutes ago

Nice. With some modifications it also helps me figure out what's going on when I'm fighting alongside someone else. Are they taking big hits, etc?


Okay, your choice of colors are getting on my nerves. Bright magenta. Really? :)

How do I change the colors?

as IF you didn't just have them unconscious, naked, and helpless in the street 4 minutes ago



My eyes!

Okay, thanks for the chart. I'll go find something less freakin' fabulous to change it to.

This is awesome! Thanks, nauta!
Useful tips: Commands |  |Storytelling:  1  2

Thanks.  It's by no means perfect.  One flaw is that the #substitute matches are a tit bit too inclusive, so they'll grab, for example,

[b]You[/b] peck [b]the tressy-tressed tressed tress[/b] on the cheek.

as IF you didn't just have them unconscious, naked, and helpless in the street 4 minutes ago

When writing an alias/ Action * = send Action %1 (which is action (target) .

How do I add a direction, so my out come is as below?

alias abbreviated Action (target) (direction)

send full Action (target) (direction)
The funny little foreign man

I often hear the jingle to -Riunite on ice- when I read the estate name Reynolte, eve though there ain't no ice in Zalanthas.

Quote from: Potaje on December 06, 2019, 08:45:31 PM
When writing an alias/ Action * = send Action %1 (which is action (target) .

How do I add a direction, so my out come is as below?

alias abbreviated Action (target) (direction)

send full Action (target) (direction)

Send me a pm so I can understand what you are asking.

I wanted to add a few thing to this post!  I have been using Windows Terminal in Windows 11 (with Ubuntu for Windows, formerly WSL) and I think it works well.  It has full unicode support, so you could have things that contain emojis if you really wanted to.

There were some tt++ changes on config settings, like buffer size and something else.. But these are the config's I use.  Notably, I'm now using #CONFIG {MOUSE} {ON} for reasons I'll get to in a minute.


#CONFIG {COLOR MODE} {256}
#CONFIG {AUTO TAB}  {5000}
#CONFIG {BUFFER SIZE}  {1000000}
#CONFIG {CHARSET}  {UTF-8};
#CONFIG {COLOR PATCH}  {OFF}
#CONFIG {COMMAND COLOR}  {<g08>}
#CONFIG {COMMAND ECHO}  {ON}
#CONFIG {CONNECT RETRY}  {15}
#CONFIG {HISTORY SIZE}  {1000}
#CONFIG {LOG} {HTML}
#CONFIG {PACKET PATCH}  {0.20}
#CONFIG {REPEAT CHAR}  {!}
#CONFIG {REPEAT ENTER}  {OFF}
#CONFIG {SCROLL LOCK}  {ON}
#CONFIG {SPEEDWALK}  {ON}
#CONFIG {TINTIN CHAR}  {#}
#CONFIG {VERBATIM}  {OFF}
#CONFIG {VERBATIM CHAR}  {\}
#CONFIG {VERBOSE}  {OFF}
#CONFIG {WORDWRAP}  {ON}
#CONFIG {MOUSE} {ON}


This is my prompt, adapted from nauta's.. It's purely personal preference.  But I also like my prompt to highlight when I'm armed or sneaking as you can see

#alias myprompt {
   prompt hp:%h/%H mv:%v/%V st:%t/%T [%s] [%w] [%E] [%e] [%A] FINPROMPT;
}
#ACTION {hp:%1/%2 mv:%3/%4 st:%5/%6 [%7] [%8] [%9] [%10] [%11] FINPROMPT} {#showme {-- hp:%1/%2 mv:%3/%4 st:%5/%6 [%7] [%8] [%9] [%10] [%11] -- } {-2};} {1}
#SUBSTITUTE {hp:%*FINPROMPT} {}
#HIGHLIGHT {[armed]} {<ffe>}
#HIGHLIGHT {[sneaking]} {<ffe>}


Another fun thing can be sounds...  This used to work better when I had Linux proper and not Win11.. It seems like enabling paplay is too hard in Win11, or too much driver hassle.  One thing I'm testing is a bit of a hack.. Getting tintin++ to trigger the default windows app for a sound.  I haven't tested enough to see if this causes lag:

#action {^A foreign} {#system wslview contact.wav};
#action {beeps you.$} {#system wslview beep.wav};


Then logging, I adapated an existing tintin++ script on the website to be able to turn logging on and off.

#alias {log}
{
#if {"%0" == "on"}
{
#if {"$logging" != "on"}
{
#format {logfile} {/mnt/c/Users/user/Documents/mudlogs/%t.html} {%Y-%m-%d};
#log append $logfile;
#showme Starting logging.;
#var logging on
};
#else
{
#showme You are already logging.
}
};
#elseif {"%0" == "off"}
{
#if {"$logging" == "on"}
{
#showme Stopping logging.;
#log off;
#var logging off

};
#else
{
#showme You are not logging.
}
};
#else
{
#showme Logging is currently $logging ... 
}
}

#var logging on
#format {logfile} {/mnt/c/Users/user/Documents/mudlogs/%t.html} {%Y-%m-%d};
#log append $logfile;


Then the last thing I wanted to get working... tintin++ maps.  First, here is my basic split setup.  It adjusts the split based on the available size in the window.  I use an alias if I change the window size and I want to reset the split properly.  I'm assuming you've already created a tintin map file which you'd do manually in the first instance.


#split 0 2 0 -83;
#map read ArmMap.map;
#map return;
#map offset 1 85 -4 -1;
#map flag vtmap on;
#ACTION {You flee, heading %.} {#map move %1} {5};
#ACTION {Come back soon!} {#map write ArmMap.map;};
#ALIAS {splitreset} {
#split 0 2 0 -83;
#map offset 1 85 -4 -1;
}



Then, mouse actions!  I wanted to be able to scroll the buffer with the mouse wheel, and I wanted to be able to move the center of my map around with the mouse.  Here is something basic which does that.  Note to access regular mouse actions (like right-click paste) hold shift.

#event {MAP REGION PRESSED MOUSE BUTTON ONE} {
        #var {o_x} %0;
        #var {o_y} %1;
        #var {pressed_at} %0;
}
#event {MAP REGION MOVED MOUSE BUTTON ONE} {
            #var d_x %0;
            #var d_y %1;
            #math {c_x} {$o_x - $d_x};
            #math {c_y} {$d_y - $o_y};
            #map center $c_y $c_x 0;

};
#event {SCROLLED MOUSE WHEEL UP} #buffer up 4;                         
#event {SCROLLED MOUSE WHEEL DOWN} #buffer down 4;


Then the last thing.. very much a work in progress, is how to actually make a map. I've always been curious about how people make maps in muds and the internet tells me that tintin++ has a powerful and flexible mapper.  So I wanted to learn it.

I adapted the logging on/off code above to have a "mapping" mode on/off.. Basically what it does is toggle #map flag static .. which automatically creates rooms as you move, but also either loads or kills a set of mapping triggers which I'm working on.  So just the on/off part:

#alias {mapping} {
#if {"%0" == "on"}
{
#if {"$mapping" != "on"}
{
    #class mapping read maptriggers.tin;
#map flag static off;
#var mapping on
};
#else
{
#showme You are already mapping.
}
};
#elseif {"%0" == "off"}
{
#if {"$mapping" == "on"}
{
#class mapping kill;
#map flag static on;
#map write ArmMap.map;
#showme No longer mapping rooms.;
#var mapping off;
};
#else
{
#showme You are not mapping.
}
};
#else
{
#showme Mapping is currently $mapping ... 
}
}


Then the triggers kept in a separate file.  Because it seemed the easiest, I used a colour trigger to grab the room name.  I set roomnames to be colour 105, exits 111, and then it's fairly easy to grab those.  The other trigger is something that automatically undoes room creation if you accidentally try and move a direction that doesn't exist.  This could be expanded alot:  automatic #map set roomsymbol or #map set roomcolor based on the room name, capturing the room descriptions, setting a variable to assign rooms you mapped to "areas" eg Allanak or Southlands etc..  But for now this is pretty basic.

#ACTION {~\e[38;5;105m%1\e[0m\e[38;5;111m [%2]\e[0m} {#map set roomname %1} {5};
#ACTION {You cannot go '%1', there is no exit that way.} {#map undo; #showme Undid room creation};