API support
Hello, I have been attempting to get the API to work with another plugin, as to play around with the application of your plugin on other's of mine.
Whilst doing so, I looked at it and had seen that you posted
DiscordMessages?.Call("API_SendTextMessage", (string)WebhookURL, (string)Message, (optional bool)TextToSpeech, (optional Plugin)Plugin);​
As an example.
Now I took this and made this
DiscordMessages?.Call("API_SendTextMessage", (string)"not here for obvious reasons", $"Player {player.displayName} ({player.userID}) got a case.", this);​
I am referencing the plugin, but I cannot get this to work.
Could you help me out @Slut, that'd be greatly appreciated!
How are you referrencing the plugin? Did you check to see if the plugin reference is null? I'd also suggest trying a simple call with the non-optional args only.
In response to Wulf ():
How are you referrencing the plugin? Did you check to see if the plugin reference is null? I'd also...
I'm using this at the current moment.
Still entirely new to plugin referencing.
if (plugins.Exists("DiscordMessages"))
            {
                DiscordMessages?.Call("API_SendTextMessage", "-----", $"Player {player.displayName} ({player.userID}) got a case.", this);
            }​
That doesn't actually reference the plugin. You'd need to add an actual reference to the plugin (outside of any methods):

[PluginReference]
private Plugin DiscordMessages;

You can then call the plugin using something like what you had before; without the unnecessary if check you have above.
In response to Wulf ():
That doesn't actually reference the plugin. You'd need to add an actual reference to the plugin (out...
I am also doing that too.
[PluginReference]
Plugin DiscordMessages;​
Just not set as private.
In response to Default ():
I am also doing that too.
[PluginReference]Plugin DiscordMessages;​Just not set as private.
It's still private, private is assumed for variables like that.

Did you check to see if DiscordMessages is null?
In response to Wulf ():
It's still private, private is assumed for variables like that.

Did you check to see if D...
I didn't check if it's null, as this plugin will require it to run, once I add the support.
But I'll add a check to see if it works.
In response to Default ():
I didn't check if it's null, as this plugin will require it to run, once I add the support.
But...
The null check was a suggestion to help you debug the issue, as right now you're just ignoring the call if the DiscordMessages reference is null.
Upon checking if it's actually there, it detects the plugin and everything. However, it doesn't call the hook in anyway sending a message.

Merged post

I can't seem to be able to post pictures, but this is what I am using.
PrintWarning(plugins.Exists("DiscordMessages") ? "So Discord Messages is here." : "Not here yo");
            DiscordMessages?.Call("API_SendTextMessage", "--", $"Player {player.displayName} ({player.userID}) got a case.", this);
            ​

And it sends that it's there.
But the call doesn't work right.

Don't use:
plugins.Exists("DiscordMessages")

That doesn't tell you that the reference is set, just that there is a file with that name.

Use a literal null check:

if (DiscordMessages) PrintWarning("Plugin reference is set!");

In response to Wulf ():
Don't use:plugins.Exists("DiscordMessages")That doesn't tell you that the reference is set, just t...
Sorry, got distracted helping someone with another plugin.
I found out I didn't have it fully referenced correctly, and I fixed it.
However, it still does not call the hook.
In response to Default ():
Sorry, got distracted helping someone with another plugin.
I found out I didn't have it fully r...
Either the reference isn't set still then, else the signature you are sending doesn't exist in the plugin.
In response to Wulf ():
Either the reference isn't set still then, else the signature you are sending doesn't exist in the p...
I'm just using what Slut had posted in the API, without the optional ones.
I'm not getting any errors from it or anything, just refusing to work.