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
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 1:22 am   

Please Help with capturing data from the prompt and calculating it.
 
I found a bunch of xp counters but they were way too complicated for me to get them to work with the mud I play.

I was hoping some once could help me write a script to track the amount of xp I get for commands and kills.

My prompt looks like this.
Hp: 1840(1840) Gp: 213(300) Xp: 2144

All I want is a script that tells me the how much xp I gain after each prompt.
So if I cast a spell and the prompt changes from

Hp: 1840(1840) Gp: 213(300) Xp: 2144
To
Hp: 1840(1840) Gp: 213(300) Xp: 2213

It would display this in the status window or on the status bar.

69 Xp gained, Current Xp: 2213

And then I would like to be able to enter a command such as “trxp” which would make it start counting the amount of Xp I am gaining then when I enter “rpxp” it show me the time I started tracking and how much xp I have gained sense I entered the command “trxp”

Started count at 7:14 Gained 30049 Xp

And every time I enter the command “trxp” it resets the counter.
Reply with quote
shalimar
GURU


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

PostPosted: Tue Dec 29, 2015 4:09 am   
 
Given your prompt, you will want a trigger similar to this:

Code:
#TR {Hp: (%d)~((%d)~) Gp: (%d)~((%d)~) Xp: (%d)} {
hp=%1
hpMax=%2
gp=%3
gpMax=%4
xpChange=(%5-@xp)
xp=%5
}


Something like that would populate the various variables from your prompt.

Showing it is simple enough, depending on where you want it seen. Just reference the @variable in the appropriate command.
#SAYADD will append to the current line.
#SAYPROMPT will prefix the next line.
#SAY, #ECHO, #SHOW, #PRINT, #MXP, #WIN are various ways to create your own line entirely.
#STATUS and #STWIN for the status window or the bar

Timed tracking is also certainly possible, but a good bit more involved.
Let me make sure you understand this much first, and go look at one of the old examples I have.
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


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

PostPosted: Tue Dec 29, 2015 4:22 am   
 
Actually, for what you want this should do:

#ALIAS trxp {
xpTrackTime=%time(t)
xpTrackStart=@xp
}

#ALIAS rpxp {#PRINT {Started count at @xpTrackTime Gained %eval(@xp-@xpTrackStart) Xp}}
_________________
Discord: Shalimarwildcat
Reply with quote
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 9:05 am   
 
Thank you so much!

The trxp to start and reset and rpxp to show the current value works exactly like i wanted

and the @xpChange is collecting the right data but I'm not shore I under stand how to show the data correctly

I typed #STWIN @xpChange and it put the current xpChange in the status window but when i get more xp and the amount changes it doesn't update the status window

I tried showing it in the prompt and that worked but it only showed once. How do i get it to show me the most recent xpChange every time the prombt appears?
Reply with quote
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 9:57 am   
 
OK i figured out what I was doing wrong I got it to work but it seems to only update when the mud pings at least i think that what you call it

Because of the delay I would miss the info i am trying to track

is there a way to add a @variable that will show the last change that is >0 so that when the xpChange resets to 0 it will still show the amount of the last xp gain?
Reply with quote
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 10:22 am   
 
OK never mind I figured it out. I added a print @xpChange to screen step to you trigger and it gave me the option to have the trigger fire when I type something so it works perfectly now

Plus now i under stand exactly how your script works

THANK YOU SO MUCH!!!!!!!!! Very Happy
Reply with quote
shalimar
GURU


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

PostPosted: Tue Dec 29, 2015 7:57 pm   
 
Glad to help, and glad you figured it out.
_________________
Discord: Shalimarwildcat
Reply with quote
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 9:29 pm   
 
I like that trigger so much I was thinking why not make one that tells me how much hp my heal spells restore and how much damage opponent's commands are doing.


my combat monitor looks like this

Hp: 1332 Faith: 116

Does this look right to you?

#TR {Hp: (%d) Faith: (%d) } {
hp=%1
hpChange=(%1-@xp)
Faith=%2
}

Does that look right to you?

And the combat monitor is different for each character I play

priest= Hp: 1332 Faith: 116

warrior= Hp: 1332 tactics: 116

so I would need to make a separate trigger for each monitor type or can I add something to make one trigger work for both?
Reply with quote
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 10:35 pm   
 
ok just relized that would try to use the same name for the hp alias the other trigger set up and i put xp in it LOL

so this should be right

#TR {Hp: (%d) Faith: (%d) } {
Chp=%1
hpChange=(%1-@Chp)
Faith=%2
}
Reply with quote
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 10:44 pm   
 
hmm why not add one for faith so i can track exactly how much faith my spell cost?

#TR {Hp: (%d) Faith: (%d) } {
Chp=%1
hpChange=(%1-@Chp)
Faith=%2
FaithChange=(%2-@Chp)
}

would that work? or does the order you put them in matter? because you put the trigger to make xpChange before xp in yours

P.S. Again thank you for helping me learn to make triggers to collect data I think i like writing triggers its almost like when i spent a month playing with Microsoft XP learning to use formulas to make spread sheets that would do most of my work for me lol
Reply with quote
shalimar
GURU


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

PostPosted: Tue Dec 29, 2015 11:03 pm   
 
You have to calculate the change with the old value of a given variable, before assigning the new value to it.

In my example I did:

xpChange=(%5-@xp)
xp=%5

Otherwise %5 and @xp have the same value and you end up with 0 every time.
_________________
Discord: Shalimarwildcat
Reply with quote
shalimar
GURU


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

PostPosted: Tue Dec 29, 2015 11:07 pm   
 
As for the changing name of faith and tactics... so long as the point pool can be said to have equivalent purposes for you on the backend (mana for your special moves) then you can easily combine them into an anonymous variable:
{Faith|Tactics}
_________________
Discord: Shalimarwildcat
Reply with quote
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 11:28 pm   
 
sorry to keep bugging you I don't know if i should ask you this here or make another post.

You answered my other question so well I was hoping you could show me how to make a script to create a timer (or an alarm) that tracks the time between kills so I know how long its been sens I have killed an NPC

When the mud displays "A dwarf keels over and dies." it would start the timer and and create a variable to show that data, then when the mud shows "A dwarf keels over and dies." again

it resets the timer and makes another variable to show the how much time passed between kills.

so I would have two variables one that is the current time sense I last kill that mob and another that tells me amount of time between the last kill and the one before that.
Reply with quote
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 11:29 pm   
 
shalimar wrote:
You have to calculate the change with the old value of a given variable, before assigning the new value to it.

In my example I did:

xpChange=(%5-@xp)
xp=%5

Otherwise %5 and @xp have the same value and you end up with 0 every time.



Ok got it thanks
Reply with quote
ogbebaba
Beginner


Joined: 02 May 2013
Posts: 10
Location: thibodaux

PostPosted: Tue Dec 29, 2015 11:43 pm   
 
shalimar wrote:
As for the changing name of faith and tactics... so long as the point pool can be said to have equivalent purposes for you on the backend (mana for your special moves) then you can easily combine them into an anonymous variable:
{Faith|Tactics}


sweet so its just like when i make my attack triggers in the mud just different syntax

so like this right?

#TR {Hp: (%d) {Faith:|Tactics:} (%d)}
Reply with quote
shalimar
GURU


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

PostPosted: Tue Dec 29, 2015 11:53 pm   
 
You should be able to keep the colon after it, rather than duplicate it, but yes, that should work.
_________________
Discord: Shalimarwildcat
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