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.

jgill33

Beginner

Posts: 0

Location: Falls Church, VA

  • Send private message

941

Monday, July 26th 2010, 7:51pm

Quoted from "Sixpax;312057"

Why not just put a check near the top of your function to see if you have low health and the vanish/hide buff in effect, and if so, just return from the function so nothing gets executed?


You are BRILLIANT! It's so simple, I never even thought about it.

Now I have an actual question, too. Here is a sample of the code I have for my rarely used M/p (I usually either play my R/k or W/s):

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
    --Healing
--  i=i+1; Skill[i] = { name = "Urgent Heal",  use = (health <= .70) }
--  i=i+1; Skill[i] = { name = "Regenerate",   use = ((health <= .90) and (not string.find(buffs,"Regenerate"))) }
    
    --Buffs
--    i=i+1; Skill[i] = { name = "Essence of Magic",  use = ((not string.find(buffs,"Essence of Magic")) or (BuffTimeLeft("player","Essence of Magic") < 5)) }

    --AOE
    if (arg2 == "aoe") then
        i=i+1; Skill[i] = { name = "Electrostatic Charge",  use = (true) }
        i=i+1; Skill[i] = { name = "Discharge",             use = (true) }
        i=i+1; Skill[i] = { name = "Purgatory Fire",        use = (true) }
    end
Now my question is:
When the function calls Regenerate or Urgent heal or even Essence of Magic the cursor turns to a wand and it waits until I click on my toon for the spell to cast, which really sucks if I'm not paying close attention. Is there a way to tell it to cast it on myself, so the cursor doesn't change and wait for a target?

Thanks in advance.

jsalemi

Trainee

Posts: 133

Location: VA, USA

  • Send private message

942

Monday, July 26th 2010, 8:06pm

Quoted from "jgill33;312127"

Now my question is:
When the function calls Regenerate or Urgent heal or even Essence of Magic the cursor turns to a wand and it waits until I click on my toon for the spell to cast, which really sucks if I'm not paying close attention. Is there a way to tell it to cast it on myself, so the cursor doesn't change and wait for a target?



There's a setting in the Interface section of the system menu (ESC to bring it up) that turns on self-casting. I believe it's in the Controls tab.

jgill33

Beginner

Posts: 0

Location: Falls Church, VA

  • Send private message

943

Monday, July 26th 2010, 8:17pm

Thanks, I'll check it out. Like I said, rarely do I play my M/p.

Edit: You are correct! Thanks a ton!

lokanu

Beginner

Posts: 14

Location: Classified.

  • Send private message

944

Tuesday, July 27th 2010, 9:28am

Quoted from "Sixpax;312057"

Why not just put a check near the top of your function to see if you have low health and the vanish/hide buff in effect, and if so, just return from the function so nothing gets executed?


That's actually what I suggested, except I included a timing bit so that after his wait period, he can continue to use the engine. You can see the full post here.

Quoted from "lokanu;311442"

Source code

1
2
3
4
5
6
...
function RogueKnight(arg1, arg2)
    if(os.time() < wait)then
        return -- If we're still in wait cycle, skip running and let the game continue
    end
...


Say he gets healed while in Vanish, and wants to use the engine to break Vanish and start attacking again. Reducing it down to a simple buff-check and return will require you to manually break out of Hide/Vanish in the event you should want to override it. Using that argument against my suggestion of a wait, it's likely that after the Healer's response time + heal's cast time, the wait will have passed and the engine would be available immediately.

Additionally, the wait method allows you to use it for various other situations where you might want a wait, w/o having to write a conditional statement for each one. You simply call a wait and it's done.

jgill33

Beginner

Posts: 0

Location: Falls Church, VA

  • Send private message

945

Tuesday, July 27th 2010, 4:05pm

Quoted from "lokanu;312467"

That's actually what I suggested, except I included a timing bit so that after his wait period, he can continue to use the engine. You can see the full post here.

Say he gets healed while in Vanish, and wants to use the engine to break Vanish and start attacking again. Reducing it down to a simple buff-check and return will require you to manually break out of Hide/Vanish in the event you should want to override it. Using that argument against my suggestion of a wait, it's likely that after the Healer's response time + heal's cast time, the wait will have passed and the engine would be available immediately.


But the way the code is written, even if he checks for the vanish buff instead of enhanced armor, he won't be able to use the engine until the buff is gone. Which means the engine can't be used to break the vanish even if he gets healed and the wait time is up, because one of the first checks is the buff check and if it passes (which it will because you've done nothing to get rid of that buff because you've been waiting) then the wait timer is reset to another 5 seconds and you are returned out of the function to wait.

The problem is the call to use vanish and how the wait timer is set. Here's how it should look to function the way you're thinking lokanu.

Source code

1
2
3
4
5
6
7
    --Vanish
    if ((health < .25) and (UnitDebuff("player",1) == nil) and CD("Vanish")) then
        i=i+1; Skill[i] = { name = "Vanish",  use = (combat) }
        CEwait(5)
        MyCombat(Skill,arg1)
        return -- Skip function and start wait cycle
     end
Also it would probably be best to add an additional check to the waiting cycle, so that if you get knocked out of vanish before the wait timer is up, you can use the engine immediately without have to wait it out.

Source code

1
2
3
if((os.time() < wait) and string.find(pbuffs,"Vanish"))then
    return -- If we're still in wait cycle, skip running and let the game continue
end
Now, this means it might have to get bumped down some so that pbuffs is defined and filled before you can check.

lokanu

Beginner

Posts: 14

Location: Classified.

  • Send private message

946

Tuesday, July 27th 2010, 8:05pm

Quoted from "jgill33;312570"

But the way the code is written, even if he checks for the vanish buff instead of enhanced armor, he won't be able to use the engine until the buff is gone. Which means the engine can't be used to break the vanish even if he gets healed and the wait time is up, because one of the first checks is the buff check and if it passes (which it will because you've done nothing to get rid of that buff because you've been waiting) then the wait timer is reset to another 5 seconds and you are returned out of the function to wait.

The problem is the call to use vanish and how the wait timer is set. Here's how it should look to function the way you're thinking lokanu.

Source code

1
2
3
4
5
6
7
    --Vanish
    if ((health < .25) and (UnitDebuff("player",1) == nil) and CD("Vanish")) then
        i=i+1; Skill[i] = { name = "Vanish",  use = (combat) }
        CEwait(5)
        MyCombat(Skill,arg1)
        return -- Skip function and start wait cycle
     end
Also it would probably be best to add an additional check to the waiting cycle, so that if you get knocked out of vanish before the wait timer is up, you can use the engine immediately without have to wait it out.

Source code

1
2
3
if((os.time() < wait) and string.find(pbuffs,"Vanish"))then
    return -- If we're still in wait cycle, skip running and let the game continue
end
Now, this means it might have to get bumped down some so that pbuffs is defined and filled before you can check.


Sure the engine can be used to break Vanish, after the wait is up. It only skips the engine during the wait. Once the wait is over, it no longer prevents it from running. No additional code needed. Vanish has a 10 minute cooldown, so it's not going to call it again for a while. You're suggesting to limit the wait cycle solely for Vanish, when I'm suggesting to leave it available for many other possible functions. I'm actually planning to use this for a R/W hand-swap idea I've been wanting to merge into DIYCE. My only further suggestion was to reduce the wait to 3 seconds as I thought 5 was a bit long.

Source code

1
2
3
4
5
6
...
function RogueKnight(arg1, arg2)
    if(os.time() < wait)then
        return -- If we're still in wait cycle, skip running and let the game continue
    end
...

This can be read literally as: "If the current time is under wait time, then return"

jgill33

Beginner

Posts: 0

Location: Falls Church, VA

  • Send private message

947

Wednesday, July 28th 2010, 12:20am

Quoted from "lokanu;312699"

Sure the engine can be used to break Vanish, after the wait is up. It only skips the engine during the wait. Once the wait is over, it no longer prevents it from running. No additional code needed. Vanish has a 10 minute cooldown, so it's not going to call it again for a while. You're suggesting to limit the wait cycle solely for Vanish, when I'm suggesting to leave it available for many other possible functions. I'm actually planning to use this for a R/W hand-swap idea I've been wanting to merge into DIYCE. My only further suggestion was to reduce the wait to 3 seconds as I thought 5 was a bit long.

Source code

1
2
3
4
5
6
...
function RogueKnight(arg1, arg2)
    if(os.time() < wait)then
        return -- If we're still in wait cycle, skip running and let the game continue
    end
...
This can be read literally as: "If the current time is under wait time, then return"


I know exactly what you mean with the os.time() < wait code at the top of the function, I really don't have a problem with that piece of code.

It's this piece of code that will not allow the engine to be used to break Vanish:

Source code

1
2
3
4
if string.find(pbuffs,"Enhanced Armor") then
    CEwait(5)
    return -- Skip function and start wait cycle
end
(Assuming the buff is changed to Vanish) This piece of code is not tied to the calling of Vanish so it is executed every time the function is called and checks for the vanish buff and if its on then sets the wait timer and the wait cycle begins. With this piece of code so near the top, every time you call the function and the wait timer is done and you are still vanished, then it will just reset the wait timer for another 5 seconds because the buff hasn't been broken, because there is no code before this that will trigger and break Vanish. See what I'm saying?

I think the wait timer is a great idea and I'm not disputing the wait timers uses or that you strictly limit it to Vanish, I'm just making a suggestion as to the way it was called and set in this case, that's all.

lokanu

Beginner

Posts: 14

Location: Classified.

  • Send private message

948

Wednesday, July 28th 2010, 10:41pm

Quoted from "jgill33;312833"

I know exactly what you mean with the os.time() < wait code at the top of the function, I really don't have a problem with that piece of code.

It's this piece of code that will not allow the engine to be used to break Vanish:

Source code

1
2
3
4
if string.find(pbuffs,"Enhanced Armor") then
    CEwait(5)
    return -- Skip function and start wait cycle
end
(Assuming the buff is changed to Vanish) This piece of code is not tied to the calling of Vanish so it is executed every time the function is called and checks for the vanish buff and if its on then sets the wait timer and the wait cycle begins. With this piece of code so near the top, every time you call the function and the wait timer is done and you are still vanished, then it will just reset the wait timer for another 5 seconds because the buff hasn't been broken, because there is no code before this that will trigger and break Vanish. See what I'm saying?

I think the wait timer is a great idea and I'm not disputing the wait timers uses or that you strictly limit it to Vanish, I'm just making a suggestion as to the way it was called and set in this case, that's all.


Then you didn't read my original suggestion post:

Quoted from "lokanu;311442"

I'm boggled here as to why you're checking for "Enhanced Armor" ... I would think you'd check for the Vanish 20 second buff, but I left it as you had it. It's 5 am and I'm tired.


Which was responded to with:

Quoted from "Pharoh93;311592"

Thank you very much for the thorough explaination, the reason I left it as "enhanced armor" is because I was messing with my code trying to get it to work and Vanish is on a 10 minute timer so i needed a buff for the wait function to check to that was more readily available. :)


I even took all the necessary precautions to avoid a symantic debate over my listed code.

jgill33

Beginner

Posts: 0

Location: Falls Church, VA

  • Send private message

949

Thursday, July 29th 2010, 12:11am

I did read you original suggestion and the reply by Pharoh 93, but you didn't read what I said, because I said assuming the buff is changed to Vanish.

But what I'm trying to tell you is that with the piece of code in question in your function, you will not be able to use the function to break out of Vanish and will be stuck waiting until the Vanish buff is up or you manually break it. (Regardless of what buff is in there)

So, I'll prove it by stepping you through the code (reference your code here and the piece in question below).
Let's say the toon is to the point where the conditions for Vanish are met.
The function is called:
-it passes by the wait timer because it hasn't been set yet
-it goes through all the gathering of data stuff
-it passes by the equipment stuff because those conditions haven't been met yet
-it gets to the line for Vanish and sets the use to true (because the conditions have been met)
-then it gets to the code in question and does nothing because the Vanish buff isn't on the toon yet because Vanish hasn't been cast yet.
-then it goes through the rest of the skills
-then it calls the Combat engine
-Combat engine casts Vanish because it's the first thing with a true

Now the function is called again:
-it passes by the wait timer because it hasn't been set yet
-it goes through all the gather of data stuff
-it passes by the equipment stuff because those conditions haven't been met yet
-it gets to the line for Vanish and sets the use to true (because the conditions have been met)
-then it gets to the code in question and sets the wait timer for 5 seconds because the Vanish buff is on the toon and then returns from the function.

Now the function is called again before 5 seconds:
-it checks the wait timer and returns from the function because it hasn't been 5 seconds yet

Now the function is called again just after 5 seconds:
-it passes by the wait timer because 5 seconds are up
-it goes through all the gather of data stuff
-it passes by the equipment stuff because those conditions haven't been met yet
-it gets to the line for Vanish (and lets say you healed up some) and sets the use to false (because you got healed)
-then it gets to the code in question and so far nothing has been done to remove Vanish buff so its still on the toon and the wait timer is set for 5 more seconds and you are returned out of the function to wait again.

Now do you see what I saying? It really had nothing to do with the wait timer or the symantics of the buff, but in the functioning of this piece of code:

Source code

1
2
3
4
5
6
    --Vanish
    i=i+1; Skill[i] = { name = "Vanish",  use = ((health < .25) and (UnitDebuff("player",1) == nil)) }
    if string.find(pbuffs,"Vanish") then
        CEwait(5)
        return -- Skip function and start wait cycle
    end
Which is why I suggested it be changed to this:

Source code

1
2
3
4
5
6
7
    --Vanish
    if ((health < .25) and (UnitDebuff("player",1) == nil) and CD("Vanish")) then
        i=i+1; Skill[i] = { name = "Vanish",  use = (combat) }
        CEwait(5)
        MyCombat(Skill,arg1)
        return -- Skip function and start wait cycle
     end

950

Thursday, July 29th 2010, 11:31am

If there is a function that finds your level then the various skills could utilize that as a condition.

pseudocode:

local level = (LevelFindingFunction("player"))

use = (( level => 10 ) and (whatever) )

951

Thursday, July 29th 2010, 4:30pm

Question: if I edit a custom function for DIYCE while in-game, do I have to restart the game for the edits to work?

jgill33

Beginner

Posts: 0

Location: Falls Church, VA

  • Send private message

952

Thursday, July 29th 2010, 4:48pm

You don't have to completely restart the game. Just reloading will do the trick and it can be done by:
Typing "/script ReloadUI()" into the chat window
or
Making a macro with "/script ReloadUI()" and put the button on your action bar (I do this since I need to reset often when testing out code)

There might be other ways, but those are what I know.

953

Thursday, July 29th 2010, 4:59pm

Quoted from "BluSky;313390"

If there is a function that finds your level then the various skills could utilize that as a condition.

pseudocode:

local level = (LevelFindingFunction("player"))

use = (( level => 10 ) and (whatever) )


Yes, you can certainly do that. The function is UnitLevel("player"), which returns two numbers: the level of your primary class and the level of your secondary class. So your code would look like this:

Source code

1
local plevel,slevel = UnitLevel("player")


so you can do separate "use" checks based on which class's skill it is.

HuBu

Beginner

Posts: 6

Location: Florida

  • Send private message

954

Thursday, July 29th 2010, 8:19pm

Is there a way to detect if multiple mobs are hitting you? I would like my 'whirlwind shield' to only hit if there are multiple mobs on me?

955

Friday, July 30th 2010, 2:22pm

Maybe someone can help me with an issue I'm having. When I use the custom function below, if I'm kiting a mob the script never executes. It starts the animation, but nothing ever happens. This only happens when I'm strafing and attacking.

Source code

1
2
3
4
5
6
7
function CustomAction(action)
   if(action == "Shot")then
    CastSpellByName(action)
   end
   return false   
end
i=i+1; Skill[i] = { ['name'] = "Custom: Shot",      ['use'] = (not friendly) }
If I just use the regular

Source code

1
i=i+1; Skill[i] = { ['name'] = "Shot",              ['use'] = (not friendly) }
, I never have an issue.

956

Friday, July 30th 2010, 3:38pm

Quoted from "HuBu;313573"

Is there a way to detect if multiple mobs are hitting you? I would like my 'whirlwind shield' to only hit if there are multiple mobs on me?


I'm not aware of any way to do that.

957

Friday, July 30th 2010, 3:43pm

Quoted from "jdstang;313807"

Maybe someone can help me with an issue I'm having. When I use the custom function below, if I'm kiting a mob the script never executes. It starts the animation, but nothing ever happens. This only happens when I'm strafing and attacking.


You need to set the return value to true when it does use Shot, otherwise the engine thinks no action was taken and tries to execute something else at the same time.

So your code should be:

Source code

1
2
3
4
5
6
7
function CustomAction(action)
   if(action == "Shot")then
    CastSpellByName(action)
    return true
   end
   return false   
end
I'm curious though why you'd use a custom action for that?

958

Friday, July 30th 2010, 7:42pm

Quoted from "Sixpax;313822"

You need to set the return value to true when it does use Shot, otherwise the engine thinks no action was taken and tries to execute something else at the same time.

So your code should be:

Source code

1
2
3
4
5
6
7
function CustomAction(action)
   if(action == "Shot")then
    CastSpellByName(action)
    return true
   end
   return false   
end
I'm curious though why you'd use a custom action for that?


It's because the "Shot" skill doesn't activate the GCD.
This means that you WANT the engine to think no action was taken and execute another action at the same time because the game would allow it.

Quoted from "jdstang;313807"

Maybe someone can help me with an issue I'm having. When I use the custom function below, if I'm kiting a mob the script never executes. It starts the animation, but nothing ever happens. This only happens when I'm strafing and attacking.

Not sure why your script isn't firing.
I have that exact function and code in amongst my code and Shot fires fine, whether strafing or still.
What makes you think it's not firing?

959

Saturday, July 31st 2010, 5:30am

Quoted from "ooglydit;313884"

It's because the "Shot" skill doesn't activate the GCD.
This means that you WANT the engine to think no action was taken and execute another action at the same time because the game would allow it.


Even though Shot doesn't activate the GCD, it does have an execution time (not the same as cast time). Every skill (including instant-cast ones) have an execution time during which no other skills can execute. As best I can tell, the execution time varies from around 0.2 to 0.4 seconds.

To test this, run this macro:

Source code

1
2
/cast Shot
/cast Wind Arrows
When Shot fires, Wind Arrows never will.

960

Saturday, July 31st 2010, 9:20pm

Quoted from "ooglydit;313884"

It's because the "Shot" skill doesn't activate the GCD.
This means that you WANT the engine to think no action was taken and execute another action at the same time because the game would allow it.


Not sure why your script isn't firing.
I have that exact function and code in amongst my code and Shot fires fine, whether strafing or still.
What makes you think it's not firing?


I can stand still and everything works perfectly, as soon as I start moving around, strafing especially, it just freezes up and never does anything. I will see my character lift up his crossbow like he's about to shoot, but never does. This keeps happening until I stop moving.