AFFECTS

AFFECTS

Postby Linx » Wed Jul 15, 2015 1:21 pm

Thought I'd share a bit of code I use to display all the Prots currently up and their timers
from the MSDP var AFFECTS in a miniConsole window
Firstly you need the "AFFECTS" var in your msdp initialise code
Code: Select all
sendMSDP("REPORT","AFFECTS")

This brings in all the currently active Prots in a Lua table "AFFECTS"

Test that it is working by casting several Prots and typing;
lua msdp.AFFECTS
in the command line. You should get something similar to below
{
rejuvenation = "401",
darksight = "6706",
grace = "384",
["detect invisibility"] = "21649",
aegis = "2177",
class = "-1",
["dark cloak"] = "2177",
["item-generated"] = "-1"
}

You see two odd ones "item-generated" and "class", we will filter them out later.
Prots with white spaces or multi-words are encapsulated in [" "]

Next, create a miniConsole to display all the Prots in (adjust x,y as needed so it sits where you want it)
Code: Select all
createMiniConsole("test",900,0,420,200)
setMiniConsoleFontSize("test", 9)
setBackgroundColor("test",20,0,0,255)

Here the miniConsole is called "test"

Next, create a new script, call it UpdateSStats
Add a Event Handler msdp.AFFECTS
(type msdp.AFFECTS in "Add User Defined Defined Event Handler:" and click the +)
and add the code as below
Code: Select all
function UpdateSStats()
clearWindow("test")
for k,v in pairs(msdp.AFFECTS) do
   if (k ~= "item-generated") then
      if k ~= "class" then
            echo("test",string.format("%-20s",string.upper(k))..string.format("%5s",os.date("*t",v).min..":"..os.date("%S",v)).."\n")
      end
   end
end
end


The miniConsole should look like the code window below and constantly update.
As a Prot falls it is removed from the table and doesn't display.

Code: Select all
DARKSIGHT            24:16
GREATER FLUIDITY     11:59
DETECT INVISIBILITY  33:19
DARK CLOAK            8:47
AEGIS                 8:47
GRACE                22:08
PETRIFIED ARMOR      28:44
IMPROVED HASTE        6:41


Any issues let me know or ask in-game

Linx
Linx
 
Posts: 6
Joined: Fri May 03, 2013 11:37 pm
Status: Offline

Re: AFFECTS

Postby *Breeze* » Thu Jul 16, 2015 12:31 am

thanks for sharing Linx.

tested it out and it works well.

here is your script in a package importable into mudlet with the package manager and added it to my mudlet-tools script generator. (made a slight change)

//Breeze
Attachments
Linx_Affects_Window.xml
Linx Mudlet Affects Window
(2.19 KiB) Downloaded 710 times
User avatar
*Breeze*
Avatar Poster
 
Posts: 520
Joined: Mon Nov 05, 2007 9:24 am
Status: Offline

Re: AFFECTS

Postby Unsub » Thu Jul 16, 2015 12:21 pm

Awesome stuff for the programmer/players. At some point, I hope someone will do some stuff for non-programmers (me) and other newbies. After playing a while, I understand that an enhanced interface is not necessary for me to play and have fun. I do enjoy my sloth.

But, for those of us playing with less info and tools it can be kind of a bummer to think we might be playing with one hand tied behind our backs.

An example would be code to allow a non-programmer to use group targeting.

You might say this has been provided, but the bits posted always assumes that the user has set variables for leaders and such installed in a way to take advantage of the snippets provided. And that the user has the knowledge and skills to adapt the snippet to their client.

Anyway, very cool stuff, good of you to share it.
Unsub
 
Posts: 19
Joined: Fri Oct 17, 2014 5:03 pm
Status: Offline

Re: AFFECTS

Postby *Breeze* » Thu Jul 16, 2015 12:59 pm

Unsub wrote:Awesome stuff for the programmer/players. At some point, I hope someone will do some stuff for non-programmers (me) and other newbies. After playing a while, I understand that an enhanced interface is not necessary for me to play and have fun. I do enjoy my sloth.

But, for those of us playing with less info and tools it can be kind of a bummer to think we might be playing with one hand tied behind our backs.

An example would be code to allow a non-programmer to use group targeting.

You might say this has been provided, but the bits posted always assumes that the user has set variables for leaders and such installed in a way to take advantage of the snippets provided. And that the user has the knowledge and skills to adapt the snippet to their client.

Anyway, very cool stuff, good of you to share it.



Already working on that. Check you pm.
User avatar
*Breeze*
Avatar Poster
 
Posts: 520
Joined: Mon Nov 05, 2007 9:24 am
Status: Offline

Re: AFFECTS

Postby Unsub » Fri Jul 17, 2015 10:38 am

Thanks Breeze for helping me with Mudlet. Much appreciated!
Unsub
 
Posts: 19
Joined: Fri Oct 17, 2014 5:03 pm
Status: Offline

Re: AFFECTS

Postby Madigan » Wed Mar 02, 2016 5:21 pm

So I stole some of the code from an old mudlet "status window" snippet but I can't seem to get it to work.

I would like to use the same miniconsole that I'm using to show affects to shows the following as well.

Code: Select all
echo("<green>-----------------------------------\n")
cecho("<green> Continent :<white> "..atcp.MSDPCONTINENT.."\n")
cecho("<green> Char      :<white> "..atcp.MSDPCHARACTER_NAME.."\n")
cecho("<green> EXP       :<white> "..atcp.MSDPEXPERIENCE.."\n")
cecho("<green> Coins     :<white> "..atcp.MSDPMONEY.."\n")
cecho("<green> AC        :<white> "..atcp.MSDPAC.."\n")
cecho("<green> HIT/DAM   :<white> +"..atcp.MSDPHITROLL.."/+"..atcp.MSDPDAMROLL.."\n")
cecho("<green> Group \n")
cecho("<green> Leader    :<white> "..atcp.MSDPGROUP_LEADER.."\n")
cecho("<green> Tank      :<white> "..atcp.MSDPTANK_NAME.."\n")
cecho("<green> Target HP :<white> "..atcp.MSDPOPPONENT_HEALTH.."/"..atcp.MSDPOPPONENT_HEALTH_MAX.."\n")
cecho("<green> Target    :<white> "..target.."\n")


Any suggestions on how to get the above data into A miniconsole also?
Madigan
 
Posts: 30
Joined: Fri Sep 17, 2010 1:22 am
Status: Offline

Re: AFFECTS

Postby *Breeze* » Thu Mar 03, 2016 4:41 am

you have to use msdp not atcp.

search my script for msdp.
you also have to tell echo/cecho which window to target.

[Utility] Affects Window
- Affects Window (mostly) by Linx
by Linx

does this already

also
lua msdp
will show what the mud is sending. will share part of my mortal script in a few days if you can't figure it out
User avatar
*Breeze*
Avatar Poster
 
Posts: 520
Joined: Mon Nov 05, 2007 9:24 am
Status: Offline

Re: AFFECTS

Postby Madigan » Thu Mar 03, 2016 4:53 am

*Breeze* wrote:you have to use msdp not atcp.

I should have clarified - i knew that, i just wanted to see those specific MSDP Attributes.

*Breeze* wrote:search my script for msdp.
you also have to tell echo/cecho which window to target.

I haven't see a script of yours doing this and I was ab le to get the mdsp attributes to echo, but exactly as you said... it was spamming it to my main window - not linx's affect's window like I was attempting.

*Breeze* wrote:[Utility] Affects Window
- Affects Window (mostly) by Linx
by Linx
does this already

Hrmm, no it only shows Affects, and i can't seem to get it to show any other msdp attribs. IF I had one example I could figure out the rest.

*Breeze* wrote:also
lua msdp
will show what the mud is sending. will share part of my mortal script in a few days if you can't figure it out

This is awesome... hes I think everything I need is being sent already ( I was able to uncomment the attributes I needed from Linx's onConnect script to get msdp.

Blix
Madigan
 
Posts: 30
Joined: Fri Sep 17, 2010 1:22 am
Status: Offline

Re: AFFECTS

Postby *Breeze* » Thu Mar 03, 2016 5:03 am

onConnect is mine.

I adapted Linx script to work with my code. and did some other changes which no one will notice.

echo("AffectsWindow", "Foo:Bar") ;
User avatar
*Breeze*
Avatar Poster
 
Posts: 520
Joined: Mon Nov 05, 2007 9:24 am
Status: Offline

Re: AFFECTS

Postby Madigan » Thu Mar 03, 2016 5:35 am

*Breeze* wrote:Screenshot.. not really as blurry as it looks but I edited it in cell phone.

https://imageshack.com/i/pmcg2qgwp

I prefer simple interface



Yes, BOOM... Exactly THIS is what I was trying to build. I have a tabbed chat window I adapted from mudlet forums on the bottom now.
Madigan
 
Posts: 30
Joined: Fri Sep 17, 2010 1:22 am
Status: Offline

Re: AFFECTS

Postby *Breeze* » Thu Mar 03, 2016 5:37 am

you should be able to finish it now. :)
User avatar
*Breeze*
Avatar Poster
 
Posts: 520
Joined: Mon Nov 05, 2007 9:24 am
Status: Offline

Re: AFFECTS

Postby Madigan » Thu Mar 03, 2016 6:13 am

*Breeze* wrote:you should be able to finish it now. :)

I must have missed something.

Code: Select all
function UpdateSStats()
   clearWindow("AffectsWindow")
   echo("AffectsWindow","\nStatus\n--------\n")
   echo("AffectsWindow"," Group Leader: "..msdp.GROUP_LEADER.."\n")
--   echo("AffectsWindow"," XP: "..msdp.MSDPEXPERIENCE.."\n")
--   echo("AffectsWindow"," XP: "..msdp.MSDPMONEY.."\n")
--   echo("AffectsWindow"," AC: "..msdp.MSDPAC.."\n")
   echo("AffectsWindow","\nAffects\n--------\n")
   for k,v in pairs(msdp.AFFECTS) do
      if (k ~= "item-generated") then
         if k ~= "class" then
      
echo("AffectsWindow",string.format("%-20s",string.upper(k))..string.format("%5s",os.date("*t",v).min..":"..os.date("%S",v)).."\n")
        end
        end
   end
end


Got one line to show up in the window, but more than one msdp var causes the whole box to clear, so I commented them out. Maybe I was supposed to gather something from what you shared in that pic aside jealousy , lol.. but its not helping me with the code.

PS - if all affects drop - the msdp vars drop too...
Madigan
 
Posts: 30
Joined: Fri Sep 17, 2010 1:22 am
Status: Offline

Re: AFFECTS

Postby *Breeze* » Thu Mar 03, 2016 6:25 am

missing the ; at the end of the commands
User avatar
*Breeze*
Avatar Poster
 
Posts: 520
Joined: Mon Nov 05, 2007 9:24 am
Status: Offline

Re: AFFECTS

Postby *Breeze* » Thu Mar 03, 2016 6:27 am

also iirc you need to use msdp["xxxx"] INSTEAD of msdp. xxxx
User avatar
*Breeze*
Avatar Poster
 
Posts: 520
Joined: Mon Nov 05, 2007 9:24 am
Status: Offline

Re: AFFECTS

Postby Madigan » Thu Mar 03, 2016 7:16 am

*Breeze* wrote:also iirc you need to use msdp["xxxx"] INSTEAD of msdp. xxxx


as far as I can tell it works the same for both syntax's.
Madigan
 
Posts: 30
Joined: Fri Sep 17, 2010 1:22 am
Status: Offline

Next

Return to Mudlet - unlimited possibilities

Who is online

Users browsing this forum: No registered users and 4 guests