Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
blarg
Beginner


Joined: 14 Jul 2015
Posts: 15

PostPosted: Mon Nov 30, 2015 4:02 pm   

msdp Battle Gauge
 
My mud sends some info about who I'm fighting via msdp. I have a gauge set up showing the opponent's life, and I had this as my caption:

Code:
%left(@opponent_name, 25) (@opponent_level) %eval(@opponent_health*@opponent_health_max/100)/@opponent_health_max


It displayed like this:

Goblin (5) 41/50

It worked great, but I wanted it to remember the information about the last monster I fought (including level and hp) in case I need to flee and come back. As soon as I flee, the mud changes the msdp variables @opponent_name becomes "None." @opponent_level "0" @opponent_health "0"

I set my gauge up to use this:

Code:
%left(@opponent_name_current, 25) (@opponent_level_current) %eval(@opponent_health_current*@opponent_health_max/100)/@opponent_health_max


and handle updates to health, level, and name like so (pardon the debugging attempts):

Code:
<alias name="update_opponent_health" id="749">
  <value>#IF  (@opponent_name =~ "None.")   
  {}
  {
    #say msdp.opponent_health updated 
    #var opponent_health_current @opponent_health
  }</value>
</alias>


Code:
<alias name="update_opponent_level" id="748">
  <value>#say attempting to update opponent level
#IF  (@opponent_name =~ "None.")
{
#say opponent name was detected as None.
}
{
#say msdp.opponent_level updated
#var opponent_level_current @opponent_level
}</value>
</alias>


Code:
<alias name="update_opponent_name" id="747">
  <value>#say msdp.opponent_name updated
#IF  (@opponent_name =~ "None.")
{}
{
#say assigning opponent_name_current to @opponent_name
#var opponent_name_current @opponent_name
}
#var opponent_name_temp @opponent_name

</value>
</alias>


It is working as intended when I flee, but the problem is opponent_health_current never gets assigned as 0, possibly because of the order that the variables are changing. I've played with a bit and just can't seem to figure it out.

Does anyone have any advice?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4238
Location: Pensacola, FL, USA

PostPosted: Mon Nov 30, 2015 4:38 pm   
 
Well, it sounds like an update bug from the game, so you could report it to admin.
As something to tide you over, you should know that when "None." pops up, change everything correlating to the current opponent.
You don't need the game to tell you if you know when it should be happening regardless.
_________________
Discord: Shalimar#3679
Reply with quote
blarg
Beginner


Joined: 14 Jul 2015
Posts: 15

PostPosted: Mon Nov 30, 2015 4:54 pm   
 
The game is properly setting opponent_name to "None." and opponent_health to "0".

I'm trying to have my gauge remember who I was last fighting when I run away. That part's working but it doesn't show when enemies die now because opponent becomes "None." as soon as they die, causing my custom "current" variables to remain as they are.
Reply with quote
blarg
Beginner


Joined: 14 Jul 2015
Posts: 15

PostPosted: Mon Nov 30, 2015 5:57 pm   
 
I think I can accomplish what I'm trying to do by using some #wait timers on when certain variables are assigned from the msdp but I must be missing something.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4238
Location: Pensacola, FL, USA

PostPosted: Mon Nov 30, 2015 8:28 pm   
 
make a trigger of type expression
a pattern of @opponent_name

It will fire automatically whenever the value changes, which you could use as an event handler
setting @lastOpponent after updating all the other necessary variables.

or you could proofcheck the %msdp to preclude a none value from being assigned in the first place, unless you have confirmation of kill.
_________________
Discord: Shalimar#3679
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Tue Dec 01, 2015 1:21 am   
 
Is there a consistent mud output that displays when you kill someone? Your best bet would probably be to just trigger off that to set the opponent_health variable to 0, rather than trying to work it into the msdp setup. I can't say for sure without examining the msdp messages being sent, but I suspect the msdp will look identical whenever you leave combat, whether by fleeing or killing the opponent, so no waits would be able to differentiate that.
Reply with quote
blarg
Beginner


Joined: 14 Jul 2015
Posts: 15

PostPosted: Fri Dec 11, 2015 4:28 pm   
 
Is there a way I can see a log of exactly what order the relevent msdp variables are coming in and what their values are before my scripts take over?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4238
Location: Pensacola, FL, USA

PostPosted: Fri Dec 11, 2015 5:04 pm   
 
the debugger might help with that, under the window menu
_________________
Discord: Shalimar#3679
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Sun Dec 13, 2015 1:36 am   
 
Yeah, open the script debugger and use the raw input/output option. Gets spammy, so be ready to turn it on right before you expect the data to be sent, then turn it off again so you can isolate it easier.
Reply with quote
glister
Beginner


Joined: 06 Mar 2014
Posts: 12

PostPosted: Tue Dec 31, 2019 8:28 pm   
 
So I put this together this will initialize MSDP on any mud and setup reporting for every available msdpvar

Code:
<class name="Initialize" id="209">
  <trigger type="Telnet" param="69" priority="10" regex="true" id="208">
    <pattern>[\x01]REPORTABLE_VARIABLES[\x02][\x05][\x02]</pattern>
    <value>#T+ BeginInit

</value>
  </trigger>
  <trigger name="BeginInit" type="Telnet" param="69" priority="11" repeat="true" regex="true" enabled="false" id="210">
    <pattern>[\x02]([a-z,_,\s]+)</pattern>
    <value>#SENDSB 69 %CHAR(1)REPORT%CHAR(2)%1
#T- BeginInit</value>
  </trigger>
  <alias name="LoadMSDP" id="211">
    <value>#sendsb 69 %CHAR(1)LIST%CHAR(2)REPORTABLE_VARIABLES
</value>
  </alias>
</class>


This one has two sets of triggers. The main ones parses through all of the msdp vars and maps them to variables. The second one puts all of the values of a sublist called group into a CMUD varaible database record. This can be used to capture content out of any custom lists that may be setup on your mud. Keep in mind you will need to modify this to work with the specific sublist.
Code:
<class name="Prod" id="189">
  <trigger name="Main" type="Telnet" param="69" priority="19" regex="true" newline="false" prompt="true" id="113">
    <pattern>^[\x01]([a-z,_]+)[\x02]([a-z,0-9,\s]+)</pattern>
    <value>#clr Combat</value>
  </trigger>
  <trigger name="Main2" type="Telnet" param="69" priority="20" regex="true" newline="false" prompt="true" id="195">
    <pattern>^[\x01]([a-z,_]+)[\x02]([a-z,0-9,\s]+)</pattern>
    <value>#VAR %1 %2

#Win Combat Tank: @Tank_Name
#Win Combat Enemy: @OPPONENT_NAME HP: @OPPONENT_HEALTH/@OPPONENT_Health_MAX</value>
  </trigger>
  <trigger type="Telnet" param="69" priority="1990" regex="true" id="199">
    <pattern>[\x01](GROUP)[\x02][\x05][\x02][\x03]</pattern>
    <value>CurMSDPTable = %1
#T+ GroupOpen
MSDPCounter = 1

</value>
  </trigger>
  <trigger name="GroupOpen" type="Telnet" param="69" priority="1991" repeat="true" regex="true" enabled="false" id="201">
    <pattern>[\x01]([a-z,_]+)[\x02]([a-z,0-9,\s]+)</pattern>
    <value>#ADDKEY @curMSDPTable @MSDPCounter {%1|%2}
MSDPCounter = @MSDPCounter + 1

#clr group
GroupSize = @MSDPCounter
#T+ GroupClose
</value>
  </trigger>
  <trigger name="GroupClose" type="Telnet" param="69" priority="1992" regex="true" enabled="false" id="202">
    <pattern>[\x01](GROUP)[\x02][\x05][\x02][\x03].*[\x04][\x06]</pattern>
    <value>//#say g2 activeated

//               NAME         

A = 1
#WHILE (@A < @GroupSize) {
#win Group @GROUP.@A.2 LvL:@GROUP.%eval(@A+1).2
#win Group HP:@GROUP.%eval(@A+3).2/@GROUP.%eval(@A+4).2 MV:@GROUP.%eval(@A+5).2;#ADD A 7}

//#win Group @GROUP.1.2 LvL:@GROUP.2.2 HP:@GROUP.4.2/@GROUP.5.2 MV:@GROUP.6.2

#T- GroupOpen
#T- GroupClose</value>
  </trigger>
</class>


Please note: The group triggers also have the syntax for pulling information out of the database variable. I'm pushing information to a windows named group. All of that isn't necessary however I left it here to have a great example of how it works.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net