|
takke Beginner
Joined: 11 Oct 2002 Posts: 29 Location: Sweden
|
Posted: Mon Oct 24, 2022 12:04 am
Calculate change |
I feel abit retarded and this shouldn't be that hard but have a problem that would be nice if someone could help me with.
I get this string from the mud when i type the command "estimate"
"Your dragons progress in the order of Contezial is 36.2%."
I play for a couple of hours and i go to a certain place and type in "estimate" again
With some luck my dragon has made progress and the percentage have changed.
I want to be able to track that change and present it in the status window.
Something like this:
Contezial: [36.2%] Change: [0%]
How could i manage this?
Thanks in advance |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: Mon Oct 24, 2022 1:13 pm |
You need at least two variables to track changes, so first, we need to capture those:
Code: |
#TR {Your dragons progress in the order of Contezial is (%d.%d)~%.} {
contezialChange=(%1-@contezial)
contezial=%1
} |
Prolly need to use concatenation to ensure no space between the number and symbol in your desired output:
#STWIN { Contezial: [%concat(@contezial, "%")] Change: [%concat(@contezialChange, "%")]}
Now if you want to display more stuff in the status window, you would need to edit the existing status object rather than make more status window objects. |
|
_________________ Discord: Shalimarwildcat |
|
|
|
takke Beginner
Joined: 11 Oct 2002 Posts: 29 Location: Sweden
|
Posted: Tue Oct 25, 2022 4:23 am |
shalimar wrote: |
You need at least two variables to track changes, so first, we need to capture those:
Code: |
#TR {Your dragons progress in the order of Contezial is (%d.%d)~%.} {
contezialChange=(%1-@contezial)
contezial=%1
} |
Prolly need to use concatenation to ensure no space between the number and symbol in your desired output:
#STWIN { Contezial: [%concat(@contezial, "%")] Change: [%concat(@contezialChange, "%")]}
Now if you want to display more stuff in the status window, you would need to edit the existing status object rather than make more status window objects. |
Thanks shlimar, this worked like a charm. I ended up using %format to get it down to 2 decimals :) |
|
|
|
|
|