Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!
Moderator: MacroQuest Developers
-
OldNecro
- a ghoul

- Posts: 136
- Joined: Thu Dec 19, 2002 3:09 am
Post
by OldNecro » Sat Feb 28, 2004 9:59 am
...or is it limited to Subs?
I want to be able to:
/if $cancast("Blood of Thule")==TRUE /cast "Blood of Thule"
and I want $cancast() to make sure that I have enough mana, the currently targeted mob is in range, I am not moving, I am standing or sitting on a mount, the spell recovery time has been met, etc and return true if conditions are right to successfully cast the spell passed. Don't need to know how to write the sub, just how to make a $command()
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.
-
Falco72
- a hill giant

- Posts: 215
- Joined: Fri Sep 26, 2003 3:24 am
Post
by Falco72 » Sat Feb 28, 2004 10:04 am
You can not do it via a $command(), BUT you do it using $return, like:
Code: Select all
/call Cancast "Blood of Thule"
/if $return==TRUE /cast "Blood of Thule"
and in the sub:
Code: Select all
Sub Cancast(SpellName)
put here the code you want and the if your checks are right use:
/return TRUE
else use:
/return FALSE
In the main, the $return will give a TRUE or FALSE value according the results of the sub.
Look in the readme for more info.
-
OldNecro
- a ghoul

- Posts: 136
- Joined: Thu Dec 19, 2002 3:09 am
Post
by OldNecro » Sat Feb 28, 2004 10:35 am
I did see that method of doing it in the man pages, but I just like to do everything the cleanest way possible, and this would have been a little more pleasing to the eye :)
Thanks for the info tho. Maybe that could be put into a future build? Would be a really cool feature...
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.
-
dont_know_at_all
- Developer

- Posts: 5450
- Joined: Sun Dec 01, 2002 4:15 am
- Location: Florida, USA
-
Contact:
Post
by dont_know_at_all » Sat Feb 28, 2004 3:20 pm
Maybe you should try comprehending the manual instead of just reading it.
-
OldNecro
- a ghoul

- Posts: 136
- Joined: Thu Dec 19, 2002 3:09 am
Post
by OldNecro » Sun Feb 29, 2004 8:45 am
I sat there for a second and tried to figure out the purpose of that little poke, or any little thing that could have been misconstrued as "stupid" about my original question, then moved on to more important things... I'm going to have to assume you were directing that to the replying poster, considering my fluency in 19 programming/scripting languages and my status as a SatComm operator for the U.S. Military. Either way, that reply was insincere, rude and totally out of place... I like you already. At any rate, thanks again to the *helpful* posters out there.
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.
-
wassup
- Official Guardian and Writer of TFM

- Posts: 1487
- Joined: Sat Oct 26, 2002 5:15 pm
Post
by wassup » Sun Feb 29, 2004 9:21 am
OldNecro wrote:I did see that method of doing it in the man pages, but I just like to do everything the cleanest way possible, and this would have been a little more pleasing to the eye :)
Thanks for the info tho. Maybe that could be put into a future build? Would be a really cool feature...
I would assume the 'little poke' is because every function you described is already in MQ2 individually, so what is the point of your request?
-
OldNecro
- a ghoul

- Posts: 136
- Joined: Thu Dec 19, 2002 3:09 am
Post
by OldNecro » Sun Feb 29, 2004 9:39 am
In that case, it was just a misunderstanding of the question...
I only wanted to know if custom $command()s could be made.
quote from my first post: "Don't need to know how to write the sub, just how to make a $command()"
The functionality I was suggesting to be put into a future build was the capability to make your own custom $command()s.
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.
-
Falco72
- a hill giant

- Posts: 215
- Joined: Fri Sep 26, 2003 3:24 am
Post
by Falco72 » Mon Mar 01, 2004 2:53 am
Just to make it clear:
from your fist post you ask for a function that can do some stuff and report back to the main a value, isn't it?
The $return command do the same thing, let you exec a sub that will do all you want ("like I have enough mana, the currently targeted mob is in range, I am not moving, I am standing or sitting on a mount, the spell recovery time has been met, etc") and will report back a true value (or any other value you need, the only limit is your fantasy) to the main.
Maybe is no so "beautifull" like a $command() but it really do the SAME THING. Now, the question we should answer is this: do we need a new command that do the same thing an existing command already do, or is it better to use our wits to make new things that will improve your MQ2 software?
Bye.
-
dont_know_at_all
- Developer

- Posts: 5450
- Joined: Sun Dec 01, 2002 4:15 am
- Location: Florida, USA
-
Contact:
Post
by dont_know_at_all » Mon Mar 01, 2004 5:31 am
OldNecro wrote:I only wanted to know if custom $command()s could be made.
Yes.
No, I will not help you. A person like yourself, who can single-handedly fly a fully operational Death Star and who knows that Kirk's middle name is Roy, will have no trouble doing it himself. In fact, you so goddam smart that I wonder why you asked the question instead just rewriting MQ in the "cleanest form possible."
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Mon Mar 01, 2004 10:50 am
Kirk's middle name is Tiberius :)
-
OldNecro
- a ghoul

- Posts: 136
- Joined: Thu Dec 19, 2002 3:09 am
Post
by OldNecro » Mon Mar 01, 2004 11:12 am
Good Lord, folks... I just wanted to clean up my code a little by using an inline function instead of needing an extra /call line...
Yes, I know about $return and fully understand how to use it. Yes, that is exactly the way my script is functioning right now. No, there's nothing wrong with doing it that way. I never said there was. I asked a simple question: "Is there any way to make inline functions?" - All I needed was a "No.", but Falco72 went the extra mile in assuming I didn't know about $return (which I did...) and explained how to use it, and for that I applaud him for being a helpful individual.
The answer to my original question is "No." - That is all I needed to know.
Thanks.
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.
-
wassup
- Official Guardian and Writer of TFM

- Posts: 1487
- Joined: Sat Oct 26, 2002 5:15 pm
Post
by wassup » Mon Mar 01, 2004 11:53 am
Well, I am not sure exactly what youmean, but I do believe you can do what you want to do using a plugin.
Snippet from the MQ2Template.cpp
Code: Select all
// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
DebugSpewAlways("Initializing MQ2Template");
// Add commands, macro parameters, hooks, etc.
// AddCommand("/mycommand",MyCommand);
[color=cyan]// AddParm("$myparm(x)",MyParm);[/color]
// AddXMLFile("MQUI_MyXMLFile.xml");
// bmMyBenchmark=AddMQ2Benchmark("My Benchmark Name");
}
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Mon Mar 01, 2004 12:28 pm
Correct Wassup. You may indeed create your own $ parameters and insert them at that point.
So the answer is yes, you can come up with your own $command and use it. If you want to merge several others into one unifying function go for it. We might not understand WHY you want to reinvent the wheel, but the API does allow you to do it.
-
OldNecro
- a ghoul

- Posts: 136
- Joined: Thu Dec 19, 2002 3:09 am
Post
by OldNecro » Mon Mar 01, 2004 12:34 pm
Not trying to re-invent the wheel... Just adding AquaTread(tm) So to speak.. :)
/if $cancast("blood of thule")==TRUE /cast 1
is 1 less line of code than
/call CanCast "blood of thule"
/if $return==TRUE /cast 1
Anal? Yes... Was just a quick question while I was in the process of coding. Since the whole function was done by the time this thread got to half its current size, it's not even worth changing now... lol
Saddam Hussein begins to use An Innocent Bystander as a living shield!
An Innocent Bystander ceases protecting Saddam Hussein's corpse.