nwesterhausen / valheim-discordconnector

A plugin to connect a Valheim server to a discord webhook.
https://discord-connector.valheim.games.nwest.one/
MIT License
25 stars 13 forks source link

Allow math with variables #275

Closed hardtimes closed 3 months ago

hardtimes commented 3 months ago

Thanks to the new variable for number of players, It can be reported, which is wonderful. However sometimes the player count doesn't update until after an event. Like a player logoff. In the following message, player count should be 0. If I could account for this using basic math, then I could could change the message to include "Number of players is now: (%NUM_PLAYERS% - 1)".

Actual message: "Grim has left to play fruit ninja because they aren't a real Viking. Number of players is now: 1"

nwesterhausen commented 3 months ago

I wonder if the math is always off on leaving, and we can just have Discord Connector automatically display NUM-1 if the message being sent is a leave message?

nwesterhausen commented 3 months ago

Set this up to specifically subtract 1 from the number of online players when the event occurring is a player leaving:

image

hardtimes commented 3 months ago

Once again, excellent work! Thank you!