You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

921

Friday, February 15th 2013, 11:21pm

Macro in DIYCE

Hey,
I am wondering how I can use a macro into my DIYCE rotation. I am using the macro for thunderstorm.
And I would like to create a PvP rotation which contain 3 spells. Those are, first Thunderstorm (the macro) then Fireball and at last Rising Tide. But I dont know how to define the macro for Thunderstorm in DIYCE.
Is is the same way as using a Potion or? Like
{ name = "Action: 0 (Macro)", use = (EnergyBar1 >= 570) or (pvp) }
And my current code for the PvP is:

Source code

1
2
{ name = "Fireball",                           use = (EnergyBar1 >= 330) or (pvp) },
{ name = "Rising Tide",                        use = (EnergyBar1 >= 318) or (pvp) },


Thanks in advance,
- B

Auros

Professional

Posts: 1,360

Mood: Mellow

  • Send private message

922

Saturday, February 16th 2013, 12:21am

Not an expert, but as far as I know, you cannot call a macro from within a macro
Govinda P/W/K/M 100x4 :pump:
Wl/R/M/Ch 100x4 :borg:
Wd/W/S 100/100/100
W/M 100/100 Glass Cannon: oh gawd, not again :pinch: ... and numerous others Semi-retired :pillepalle:

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

923

Saturday, February 16th 2013, 12:57am

Quoted from "Auros;589192"

Not an expert, but as far as I know, you cannot call a macro from within a macro

Correct. Macros are purposefully blocked from running from other macros or from the chat frame (as well as other places/conditions).

Quoted from "BloodyArrow;589187"

Hey,
I am wondering how I can use a macro into my DIYCE rotation. I am using the macro for thunderstorm.
And I would like to create a PvP rotation which contain 3 spells. Those are, first Thunderstorm (the macro) then Fireball and at last Rising Tide. But I dont know how to define the macro for Thunderstorm in DIYCE.
- B

There are some possibilities, but /wait would not work, nor would you be able to use /use or /cast commands, so it would be useless for your purposes.

What you might be able to do is duplicate the work that your macro is doing as DIYCE skill lines though if you are using some /wait commands in it, you would still have some problems.
2013... The year from hell....

924

Saturday, February 16th 2013, 2:07am

The macro I use is:

Source code

1
2
3
4
/script CastSpellByName("Thunderstorm")
/wait 0.15
/script CastSpellByName("Thunderstorm")
/script SpellTargetUnit() 

And I must say that I dont know how to duplicate the work the macro is doing in DIYCE. So I would appreciate some help if thats possible.
Thanks in advance,
- B

925

Saturday, February 16th 2013, 2:48am

What would be the corresponding DIYCE skill lines for commands like: /use and /cast ?

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

926

Saturday, February 16th 2013, 4:14am

Quoted from "arkanic;589211"

What would be the corresponding DIYCE skill lines for commands like: /use and /cast ?

Just normal DIYCE usage, it's what it does. For /cast, just use a normal name = "whatever spell/skill". For /use, do name = "Item: name of item".


Quoted from "BloodyArrow;589208"

The macro I use is:

Source code

1
2
3
4
/script CastSpellByName("Thunderstorm")
/wait 0.15
/script CastSpellByName("Thunderstorm")
/script SpellTargetUnit() 

And I must say that I dont know how to duplicate the work the macro is doing in DIYCE. So I would appreciate some help if thats possible.
Thanks in advance,
- B

The /wait is what will give you trouble here. The call to SpellTargetUnit() seems redundant to me since it'll clear the target for a targeting spell but as it is done at the end of the macro, I don't see the point of it.

Anyway, since the double Thunderstorm cast is done at the start of your rotation, we can do some funky trickery to pull this off ;).

First, we'll create a second DIYCE function to pull off the first cast of the Thunderstorm. At the very end of CustomFunctions.lua, create a new function that defines the single skill line for Thunderstorm (only include variables that you need to get the condition(s) for casting it). Something like:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
function StartWithThunderstorm()
    [I]put vars you need here[/I]

    Skill = {
        {name = "Thunderstorm", use = [I]put whatever condition you need here as normal[/I]},
    }

    if MyCombat(Skill) then
        UsedTStorm = true    -- This variable MUST remain global
    else
        UsedTStorm = false
    end
end


Now the macro to start your DIYCE becomes:

Source code

1
2
3
4
/run if not UsedTStorm then StartWithThunderstorm() end
/run if not UsedTStorm then KillSequence() end
/wait 0.15
/run if UsedTStorm then CastSpellByName("Thunderstorm") SpellTargetUnit() UsedTStorm = false end

Try this and see if that works for you.

Edit
Forgot to mention that you should remove any calls to Thunderstorm in KillSequence (that is, those that was the macro thing) since it is now handled via the macro and the new function.
2013... The year from hell....

927

Saturday, February 16th 2013, 4:44pm

Ok Peryl. First of all this is a huge step for me hehe. I'm not very good at programming. But if I start with the first function you posted.

Source code

1
2
3
4
function StartWithThunderstorm()     [I]put vars you need here[/I]      
Skill = {         {name = "Thunderstorm", use = [I]put whatever condition you need here as normal[/I]},     }      
if MyCombat(Skill) then         UsedTStorm = true    -- This variable MUST remain global     
else         UsedTStorm = false     end end

The place where you said "put vars you need here". Is here the place where I write the required mana to cast it etc? If it is that, how to I write it there, is it between the parameters at StartWithTunderstorm("") or? And then we move to the skill row. You said put condition you need here, and my conditions are for farming and PvP. So that means it should look like: use = (EnergyBar1 >= 570) or (pvp) }, I guess. I just dont know and dont understand how to write the variables after the StartWithThunderstorm().
Thanks in advance,
- B

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

928

Saturday, February 16th 2013, 5:37pm

Quoted from "BloodyArrow;589274"

Ok Peryl. First of all this is a huge step for me hehe. I'm not very good at programming. But if I start with the first function you posted.

Source code

1
2
3
4
function StartWithThunderstorm()     [I]put vars you need here[/I]      
Skill = {         {name = "Thunderstorm", use = [I]put whatever condition you need here as normal[/I]},     }      
if MyCombat(Skill) then         UsedTStorm = true    -- This variable MUST remain global     
else         UsedTStorm = false     end end

The place where you said "put vars you need here". Is here the place where I write the required mana to cast it etc? If it is that, how to I write it there, is it between the parameters at StartWithTunderstorm("") or? And then we move to the skill row. You said put condition you need here, and my conditions are for farming and PvP. So that means it should look like: use = (EnergyBar1 >= 570) or (pvp) }, I guess. I just dont know and dont understand how to write the variables after the StartWithThunderstorm().
Thanks in advance,
- B

Basically, you are creating a specialized version of KillSequence, so use that function as a guide for constructing your new function.

Since your Thunderstorm skill is going to use the variables EnergyBar1 and pvp, make sure that those variable are defined at the start of the function, in the same manner as they are in KillSequence (you can just copy/paste the variable definitions from KillSequence). The lines you want are the local EnergyBar1 = whatever and local pvp = whatever.

Note that I didn't define any parameters for this new function. If you do use special parameters when calling KillSequence, copy the same parameter variables to the new function as well and modify the new macro to include those parameters.
2013... The year from hell....

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

929

Saturday, February 16th 2013, 6:14pm

Just wanted to add a note for people that may be wondering how the above weirdness is actually working.

Effectively, we are using two different things to pull off this effect. First is that the MyCombat function (part of DIYCE) returns a true or false value if it actually used a skill in the provided skill list, the second is that only the main macro is capable of using /wait commands.

So essentially, we use a specialized version of the KillSequence function to attempt the first skill/spell and if it worked, do a /wait in the main macro then cast the second skill. If the specialized function didn't use the skill, we redirect to DIYCE's normal KillSequence function instead.

Something to note, the /wait command technically always ends up being used, it is just that after the wait, the macro would do nothing if the specialized function didn't cast that first skill.

To make this clearer, lets go over line by line as the game would execute the macro and Lua functions.

First, lets see what happens when the first skill would get used.

The whole thing starts via the macro, so the first thing the game does is:

Source code

1
/run if not UsedTStorm then StartWithThunderstorm() end

As this is the first time it is running, UsedTStorm will either be false or nil so it will call the StartWithThunderstorm() function.

So in StartWithThunderstorm(), the game will setup the Skill line for Thunderstorm and since we are assuming that it can be used, the use = condition will become true.

The game then calls DIYCE's MyCombat() function with our one line skill table and as we are again assuming that the skill gets used, MyCombat will return true which then sets the global variable UsedTStorm to true as well.

We now exit the function and proceed to the second line of the macro:

Source code

1
/run if not UsedTStorm then KillSequence() end

Since UsedTStorm is now true after the call to StartWithThunderstorm(), this effectively does nothing.

The game then does the /wait 0.15 line of the macro and after that delay performs the last line of the macro:

Source code

1
/run if UsedTStorm then CastSpellByName("Thunderstorm") SpellTargetUnit() UsedTStorm = false end

As UsedTStorm is indeed true at this point, this line casts the second Thunderstorm skill and then does the SpellTargetUnit() call (which was the two commands that the original macro we are emulating did) and finally we reset the UsedTStorm global variable to false.


Now lets see what happens when it doesn't use that first Thunderstorm.

As before, the game goes through the same first line and calls the StartWithThunderstorm() function. And as before sets up the one line Skill list and calls my combat. However this time, since it didn't use the skill, MyCombat returns false and so UsedTStorm also gets the value of false.

Now when the game executes that second line in the macro, since UsedTStorm is false, it will call the normal KillSequence function which does the normal DIYCE thing.

Once that is done, the game now does the /wait 0.15 (even though it is actually redundant at this point, but there is no way around this). Now after the delay, it runs the last line of the macro but as UsedTStorm is still false, the macro line does nothing.


The last thing to check is how this whole thing works while spamming the macro.

Since it is technically possible to start the macro while a previous call was in the middle of the /wait part, the first line of the macro requires that check of the UsedTStorm variable so that it doesn't attempt to call the StartWithThunderstorm function if it had previously started with it, but has yet to do the final part (the last line of the macro).
2013... The year from hell....

930

Saturday, February 16th 2013, 7:33pm

Done all you said Peryl, it's working! But this is only the part for the Thunderstorm Macro I used to have right? The question now is how do I combine this with the other skills. Currently it is using Thunderstorm whole the time when I'm spamming the macro in game. My goal is like this, for example, use Thunderstorm to find/locate a player in PvP, after I used Thunderstorm use Fireball and if the target isnt dead it use Rising Tide. So the order will be Thunderstorm, Fireball, Rising Tide.
Thanks in advance,
- B

931

Saturday, February 16th 2013, 8:02pm

prob easiest to make another argument with only TS as the skill

like

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function KillSequence(arg1, TS, healthpot, manapot, foodslot)

--then in skll list



if mainClass == "MAGE" and subClass == "WARRIOR" then
            

                
                if  (TS == "roguestalker") then 

                Skill = {
                    { name = "Thunderstorm",               use =true },

                 elseif enemy then

                Skill = {

blah blah

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

932

Sunday, February 17th 2013, 6:26am

Quoted from "BloodyArrow;589300"

Done all you said Peryl, it's working! But this is only the part for the Thunderstorm Macro I used to have right? The question now is how do I combine this with the other skills. Currently it is using Thunderstorm whole the time when I'm spamming the macro in game. My goal is like this, for example, use Thunderstorm to find/locate a player in PvP, after I used Thunderstorm use Fireball and if the target isnt dead it use Rising Tide. So the order will be Thunderstorm, Fireball, Rising Tide.
Thanks in advance,
- B

It should call the remainder of the skill list (effectively the old KillSequence() function) if it didn't use Thunderstorm. Therefore, adjust the conditions under which Thunderstorm is to be used. Since it is for PvP, make sure there is an and pvp in the use clause so that it will only trigger in PvP to begin with. You'll also probably want other conditions so that it doesn't always select Thunderstorm.
2013... The year from hell....

933

Monday, February 18th 2013, 6:14pm

nvm got it to work

934

Tuesday, February 19th 2013, 9:53pm

Quoted from "Peryl;589378"

It should call the remainder of the skill list (effectively the old KillSequence() function) if it didn't use Thunderstorm. Therefore, adjust the conditions under which Thunderstorm is to be used. Since it is for PvP, make sure there is an and pvp in the use clause so that it will only trigger in PvP to begin with. You'll also probably want other conditions so that it doesn't always select Thunderstorm.


It uses Thunderstorm when I press the macro. And I set the conditions to and PvP. But for PvP, I want Thunderstorm to be used when press the macro and the AoE affects a player, I want the target/mob automaticlly targeted and when I press the macro again I want Fireball and Rising Tide to be used. The function for Thunderstorm looks like below:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function StartWithThunderstorm(arg1, goat2, healthpot, manapot, foodslot)

    local Skill = {}
    local Skill2 = {}
    local i = 0
    
    -- Player and target status.
   
    local EnergyBar1 = UnitMana("player")
    local pvp = (zoneid == 402 or zoneid == 442)

    Skill = {
        {name = "Thunderstorm",         use = (EnergyBar1 >= 570) or (pvp) },
    }

    if MyCombat(Skill) then
        UsedTStorm = true    -- This variable MUST remain global
    else
        UsedTStorm = false
    end
end


The KillSequence() skill rotation looks like below:

Source code

1
2
3
4
5
6
7
8
9
elseif ((enemy) and (goat2 == "2")) then
                Skill2 = {
                            { name = "Silence",                            use = silenceThis and EnergyBar1 >= 50 and (pvp or party) },
                            { name = "Lightning",                          use = (EnergyBar1 >= 212) and (pvp) },
                            { name = "Fireball",                           use = (EnergyBar1 >= 330) and (pvp) },
                            { name = "Rising Tide",                        use = (EnergyBar1 >= 318) and (pvp) },
                         }
                     
                end

Thanks.
- B

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

935

Tuesday, February 19th 2013, 10:20pm

Quoted from "BloodyArrow;589622"

It uses Thunderstorm when I press the macro. And I set the conditions to and PvP. But for PvP, I want Thunderstorm to be used when press the macro and the AoE affects a player, I want the target/mob automaticlly targeted and when I press the macro again I want Fireball and Rising Tide to be used.

And I re-iterate. You must change the conditions (i.e. the use = whatever) under which Thunderstorm is to be used. Since you want it to trigger when in PvP, you must first change the condition from or pvp (as you have it currently) to and pvp.

Since you also want it to trigger when you don't currently have a target (since that is part of what you are using this for), you will also want to check for that as well with and not LockedOn (remember to add this to the local variable definitions as well).

Just with these changes, your condition should then become:

Source code

1
{ name = "Thunderstorm",  use = EnergyBar1 >= 570 and pvp and not LockedOn },

In short, the above says, if you have enough mana and you are PvP'ing and you don't currently have a target, try to use the Thunderstorm skill.

You'll have to decide what other conditions you want to check for and add them in as appropriate.
2013... The year from hell....

936

Wednesday, February 20th 2013, 12:30am

to have TS in diyce like that, automated, u would need it to force u to stop moving...otherwise u get a little blip of TS and cancel it :P

937

Thursday, February 21st 2013, 1:22pm

Quoted from "pazuzzu;589639"

to have TS in diyce like that, automated, u would need it to force u to stop moving...otherwise u get a little blip of TS and cancel it :P


True that, did all that Peryl said in the code now. It casts the other KillSequence() when TS is used. But when I keep spamming the macro I am suddenly moving to the side. Could that be of the TargetNearestEnemy or?
-B

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

938

Thursday, February 21st 2013, 1:44pm

Quoted from "BloodyArrow;589738"

True that, did all that Peryl said in the code now. It casts the other KillSequence() when TS is used. But when I keep spamming the macro I am suddenly moving to the side. Could that be of the TargetNearestEnemy or?
-B

Huh? That's confusing. There is nothing in DIYCE that should move your character unless you have "click to move" turned on. Then again, if DIYCE is attempting to use a skill that is slightly out of range, the game sometimes moves you into range before using the skill, but otherwise you shouldn't be moving at all.

Unless something is interfering (as in another add-on) or you are triggering the skill via a hot-keyed action button that has the same key as one of the movement buttons (unlikely), I just don't see how DIYCE would be causing this effect.
2013... The year from hell....

RoMage

rustyx is lame rogue

Posts: 2,694

Location: web

Occupation: DB Admin

Mood: Unsure

  • Send private message

939

Thursday, February 21st 2013, 2:36pm

There is something with TS that does that. I have TS macro, and every once in a while my character would move, even I did not click anywhere, just holding mouse over area I like to cast TS. It has to do with skill, not DIYCE.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

940

Thursday, February 21st 2013, 4:27pm

Quoted from "RoMage;589745"

There is something with TS that does that. I have TS macro, and every once in a while my character would move, even I did not click anywhere, just holding mouse over area I like to cast TS. It has to do with skill, not DIYCE.

That explains the movement oddity. Since TS is an area of effect spell, this may explain the movement if the game moves you in range of the location you are trying to cast it on.

As to the game moving you while merely hovering the mouse, well that would appear to be a bug (a bug! ... gasp, say it ain't so!) though it occurs to me that you could use that as a "feature" (or minor exploit, depending on your view) by running around with the mouse cursor prepped for casting TS and you'd be a mere click away from casting it. Dunno if that would work but hey...
2013... The year from hell....