Page 2 of 2
Re: [Orion] DPS Tracker
Posted: Mon Mar 13, 2023 8:43 pm
by Alibaster
Thanks for helping me with this MagicUser. I don't have any other scripts running and EchoDamge is on. The script used to work fine but stopped one day after I was playing around in the Orion settings. I was trying to get my autolooter to loot faster. Not sure what I checked that would have broken the script. The script actually will not load but it must run since I get the following in game:

- Screenshot 2023-03-13 183405.jpg (87.11 KiB) Viewed 7586 times
Here is what the debug mode looks like

- Screenshot 2023-03-13 183431.jpg (309.05 KiB) Viewed 7586 times
Hope that helped
Re: [Orion] DPS Tracker
Posted: Wed Mar 15, 2023 2:48 am
by MagicUser
I sent you a pm in game. Since I can't replicate this, I'm thinking I'll need to be at least live talking with you (in game) to attempt to figure this out. We'll probably start with Orion.Print'ing the values to see what's going on there, but yeah. Having to wait a day to get a response from me over the forum is probably not going to work if this is a more complex problem. Even if not having access to this isn't a game breaker, I'd like to help find out what this is.
As for your screen shot, I have no idea, my only assumption is that it is automatically going line by line. It does make me question why this was the first line though. Seems like the first line would be the first line of ShowDPS which would be:
Since the second function has parameters, you shouldn't be able to run it from the drop down, so Idk. Hopefully we can figure this out during our chat.
Alibaster wrote: Mon Mar 13, 2023 8:43 pm
Thanks for helping me with this MagicUser.
Sure thing

. You've piqued my curiosity. Besides, I'd rather you run into this problem on something inconsequential now and resolve it, than me run into this problem on something important later.

Re: [Orion] DPS Tracker
Posted: Fri Mar 17, 2023 12:57 am
by MagicUser
We got it.
PSA - Don't have "Show all scripts" checked or make sure you are selecting the correct function.
To run the loop, you need to play "ShowDPS" not DPSGump.

- show_all_scripts.jpg (66.51 KiB) Viewed 7545 times
I didn't even realize there was a show all scripts button. I saw what was going on earlier, but I figured there was no way that you could select the other function on the drop down.
Re: [Orion] DPS Tracker
Posted: Sun May 12, 2024 1:27 pm
by Melkor
This is a really neat tool. It would be cool if it gave average dps per minute or 30 seconds too.
Re: [Orion] DPS Tracker
Posted: Sun Oct 20, 2024 11:06 am
by Melkor
I edited the script to include an average DPS over 10 seconds. It's great for testing things. I made one for 30 seconds but it seemed too long.
Code: Select all
function ShowDPS() {
var dps = 0;
var highestdps = 0;
var totalDamage10s = 0;
var damageBuffer10s = [];
var bufferTime10s = 10;
var lastMessage = null;
var pastMessage = null;
var damage_text = [];
while (true) {
dps = 0;
lastMessage = Orion.LastJournalMessage();
pastMessage = lastMessage;
while (pastMessage && pastMessage.Timer() > Orion.Now() - 1000) {
if (pastMessage.Serial() == '0xFFFFFFFF' && Orion.Contains(pastMessage.Text(), 'damageecho') && !Orion.Contains(pastMessage.Text(), Player.Serial())) {
damage_text = pastMessage.Text().match(/^damageecho:\s\w*=\w*\s\w*=(\d*)/i);
var damage = parseInt(damage_text[1]);
dps += damage;
var timestamp = Orion.Now();
damageBuffer10s.push({ damage: damage, time: timestamp });
totalDamage10s += damage;
}
if (dps > highestdps) {
highestdps = dps;
}
pastMessage = pastMessage.PrevMessage();
}
while (damageBuffer10s.length > 0 && Orion.Now() - damageBuffer10s[0].time > bufferTime10s * 1000) {
totalDamage10s -= damageBuffer10s.shift().damage;
}
var averageDPS10s = totalDamage10s / bufferTime10s;
DPSGump(dps, highestdps, averageDPS10s);
Orion.Wait(200);
}
}
function DPSGump(dps, highestdps, averageDPS10s) {
var gump = Orion.CreateCustomGump(1);
gump.Clear();
gump.AddHtmlGump(1, 0, 0, 200, 80, '0x1400', 1, 0);
gump.AddText(10, 10, '0x0035', 'Current DPS -- ' + dps);
gump.AddText(10, 30, '0x0035', 'Highest DPS -- ' + highestdps);
gump.AddText(10, 50, '0x0035', 'Avg DPS (10s) -- ' + averageDPS10s.toFixed(2));
gump.Update();
}