Plugin check

Status
Not open for further replies.

unity0110

Lifetimer
Joined
Mar 23, 2007
Messages
594
Reaction score
0
Points
0
This will check if a plugin is loaded and if not, it will attempt to load it

ex. /call pluginCheck MQ2Melee

Code:
sub pluginCheck(string pluginName)
/if (!${Plugin[${pluginName}].Name.Length}) {
/echo ${pluginName} was not found, attempting to load it.
/plugin ${pluginName}
/if (!${Plugin[${pluginName}].Name.Length}) {
/echo ${pluginName} could not be loaded.
}
}
/return
 
could also just add this at the beginning of whatever mac ya got


/if (!${Plugin[MQ2PLUGINNAME].Name.Equal[mq2pluginname]}) /squelch /plugin MQ2PLUGINNAME nocheck

I take no credit for this, JJ told me this awhile ago.
 
thanks for the coding lesson, although I do believe my function does a bit more...
 
the one i posted, umm checks if the plugin is loaded and if not it loads it. ........ isn't that what your sub does?

i guess i see how yours checks when called ,

i see your is less typing i guess. the one i posted you'd have to edit the part where the plugin name goes and put in a different one and yours youd have to just /call plugincheck MQ2PLUGINNAME.

Wasn't trying to give a lesson, was just offering up another way of doing the same thing without having to make a sub.
 
Good stuff. But you don't have to check length, etc. If the plugin is not loaded, it will return NULL for the TLO.

i.e.: /if (${Plugin[MQ2MMOBugs]}) /echo plugin is loaded

The default is .Name, which returns either the plugin name or NULL.

Loaded:
/echo ${Plugin[MQ2MMOBugs]}
mq2mmobugs

Not loaded:
/echo ${Plugin[MQ2MMOBugs]}
NULL

That's what it should show anyway...

htw
 
Good to know, thanks htw, you provide useful information
 
i'll keep my comments to myself next time. was just trying to be helpful.

Yeah thanks htw you post helpful stuff.
 
i'll keep my comments to myself next time. was just trying to be helpful.


No need. For whatever reason people seem to become defensive when someone else offers up another method.

It's always helpful to know there is more than one way to accomplish something. For someone starting out, it helps out allot. Thank you.
 
It's not another method, it's pretty much the same thing, just ends up being more code if you have a few plugins that you're checking, mine also does a check after attempting to load the plugin to see if it was able to load it or not thus being different...
 
Congrats on being different.
Code:
sub pluginCheck(string pluginName)
     /if (!${Plugin[${pluginName}]}) {
          /echo ${pluginName} was not found, attempting to load it.
          /plugin ${pluginName}
     /if (!${Plugin[${pluginName}].Name.Length}) {
          /echo ${pluginName} could not be loaded.
     }
     }
/return
or
Code:
/if (!${Plugin[MQ2PLUGINNAME]]}) /squelch /plugin MQ2PLUGINNAME nocheck
If you fail to load a plugin, you'll get a message anyway. for 'lines' of code, you'd need to be concerend about 9 plugins before the sub with a /call is equal to his one line. Ten before your code took up less lines.

They are two different ways of doing something.

So, is everyone having a tremendous case of PMS this month? While we're being pissy, in an attempt to restore international relations, thank VI for having posted his 'lesser' version a while ago, which I found via the search function!! :)

BC
 
It's not another method, it's pretty much the same thing, just ends up being more code if you have a few plugins that you're checking, mine also does a check after attempting to load the plugin to see if it was able to load it or not thus being different...

Your Sub actually generates more lines of macro code. You have 1 line for every call line then 9 lines of sub. So with the sub if you check 9 plugins you have 19 lines of code vs 9 lines if you use the single line check. Each line of code is 4k memory use age.
 
Yeesh, enough arguing. It's a simple macro line, or subroutine, no matter how you look at it. To each their own, and insulting each other just makes people less likely to help out in the future.

Closing the flamer, the OP has been answered and even kindly acknowledged it.

htw
 
Oops, ok so the guy got his answer in the other thread, but the rest of my post still applies. ;)

htw
 
Status
Not open for further replies.