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.

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

1,341

Sunday, September 7th 2014, 6:36pm

You can't. You cannot execute a macro from a Lua function.

Having said this, it is possible to execute some macro stuff from Lua, but some of the functionality is lost (no /wait, /cast, /use for example). and making it run an entire macro even with these limitations is annoying at best.

You are better off converting your macro to a full fledged Lua function. Then you'll have the best of both worlds.
2013... The year from hell....

1,342

Thursday, September 18th 2014, 5:04pm

anyone want to share their k/p script? I run as a heal Priest mostly and know that RoM has changed some knight skills abit my current script is ok but I'm not knowledge able about what skills in what order could be better, knight is lv74 1h sword/shield user, script will be for personal farming (not dungeon tanking) I won't need aggro increases, just dps and heal/def
98/98/61 osha p/k/r
overheard in guildchat: "Its RoM if you're not lagging, you've crashed" "from your lips to frog's ears"

1,343

Saturday, September 27th 2014, 2:30am

Buff Routine

I'm trying to make a simple buffing routine in diyce. One line seems to be messing everything up, and I can't figure out what i've done wrong. Any advice would be appreciated.

Source code

1
{ name = "Action: 25 (Food)",					use = (not combat) and (not pbuffs[507050]) and (not pbuffs[507041]) or (pbuffs[507050].time <= 45) or (pbuffs[507041].time <= 45) },


It's supposed to use whatever food i have in slot 25 if Juicy Battered Fish or Juicy Spare Ribs are not already on me or if they have 45 or fewer seconds left before they run out. Thanks!

1,344

Monday, November 10th 2014, 11:35am

--Class Warlock/Champion
elseif mainClass == "HARPSYN" and subClass == "PSYRON" then

--Potions and Buffs
Skill = {
{ name = "Sublimation Weave Curse", use = ((EnergyBar1 >= 50) and (not pbuffs['Sublimation Weave Curse'])) },
{ name = "Mind Rune", use = ((EnergyBar1 >= 15) and (not pbuffs['Mind Rune'])) },
{ name = "Saces' Fury", use = ((EnergyBar2 >= 10) and (not pbuffs['Saces' Fury'])) },
}

--Combat
if enemy then
Skill2 = {
{ name = "Willpower Blade", use = (PsiPoints == 6) },
{ name = "Saces' Impulse", use = ((pbuffs ['Willpower Blade']) and (PsiPoints >= 2) and (not pbuffs['Saces' Impulse'])) },
{ name = "Severed Consciousness", use = ((pbuffs ['Willpower Blade']) and (PsiPoints >= 2)) },
{ name = "Heart Collection Strike", use = (EnergyBar1 <= 50) },
{ name = "Weakening Weave Curse", use = ((EnergyBar1 >= 20) and (not tbuffs['Weakened'])) },
{ name = "Warp Charge", use = ((EnergyBar1 >= 30) and (not pbuffs['Warp Charge'])) },
{ name = "Puzzlement", use = (EnergyBar1 >= 20) },
{ name = "Energy Influx Strikes", use = ((EnergyBar2 >= 30) and (tbuffs['Electrocution'])) },
{ name = "Electrocution", use = ((EnergyBar2 >= 20) and (not tbuffs['Electrocution'])) },
{ name = "Psychic Arrows", use = (PsiPoints <= 6) },
}




its not even able to play, if I clock on the diyce makro it just changes the enemy^^ that who's it has to be anything IN the Script for warlock/champ
Don't know if someone answered this poor little guy, so i will.

Source code

1
{ name = "Saces' Fury",                                  use = ((EnergyBar2 >= 10) and (not pbuffs['Saces' Fury'])) },

change it to

Source code

1
{ name = "Saces' Fury",                                  use = ((EnergyBar2 >= 10) and (not pbuffs["Saces' Fury"])) },

'saces' fury' to "saces' fury" :)

1,345

Monday, November 10th 2014, 11:58am

RE: Buff Routine

I'm trying to make a simple buffing routine in diyce. One line seems to be messing everything up, and I can't figure out what i've done wrong. Any advice would be appreciated.

Source code

1
{ name = "Action: 25 (Food)",					use = (not combat) and (not pbuffs[507050]) and (not pbuffs[507041]) or (pbuffs[507050].time <= 45) or (pbuffs[507041].time <= 45) },


It's supposed to use whatever food i have in slot 25 if Juicy Battered Fish or Juicy Spare Ribs are not already on me or if they have 45 or fewer seconds left before they run out. Thanks!


Where is (Food) defined?

In your macro you should be declaring your foodslot as 25 I.e.:

Source code

1
/run KillSequence(arg1, mode, healthpot, manapot, Healslot, foodslot, speedpot, ragepot, HoTslot)


Generally My macro looks something like this:

Source code

1
/run KillSequence("v1",dps,21,22,"",25)
SirMasterBlue
Areafiftyone GL
Your roving muse reporter
K60/R60
Artemis

This post has been edited 1 times, last edit by "SirMasterBlue" (Nov 10th 2014, 2:03pm) with the following reason: Adding info


1,346

Monday, November 10th 2014, 12:03pm

On your mind so it remind you :P

1,347

Monday, November 10th 2014, 12:06pm

On your mind so it remind you :P


I just ate. :P ;)
SirMasterBlue
Areafiftyone GL
Your roving muse reporter
K60/R60
Artemis

hangman04

Savage Warrior

Posts: 113

Location: Romania

Mood: Smile

  • Send private message

1,348

Monday, November 24th 2014, 11:44am

Hello,

Fast question: which is the last version of DIYCE.lua. Still the 2.4 version from page 1, or the version from curse 2.4.2 or it has been optimized here on forums to a new version ? Kinda hard to find this in over 68 pages of info....


thanks in advance.

1,349

Monday, November 24th 2014, 4:39pm

Hello,

Fast question: which is the last version of DIYCE.lua. Still the 2.4 version from page 1, or the version from curse 2.4.2 or it has been optimized here on forums to a new version ? Kinda hard to find this in over 68 pages of info....


thanks in advance.


Short answer...yes

You can grab it from page 1 or from curse (I'm pretty sure they are both 2.4.2), but, you will find many modifications in the 68 pages and the archives that you might like (depending on your classes)
Good Luck
SirMasterBlue
Areafiftyone GL
Your roving muse reporter
K60/R60
Artemis

1,350

Wednesday, November 26th 2014, 10:36pm

Is there anyway someone could put together a "best of" with good scripts for all the classes? I would like to try out, k/m, k/war, k/p, m/k but searching through this huge thread is confusing. The scripts that come with the engine seem outdated.

If anyone could post some new good scripts for all the class combos it would be great.

1,351

Wednesday, November 26th 2014, 11:22pm

go make them

1,352

Thursday, November 27th 2014, 6:01am

Is there anyway someone could put together a "best of" with good scripts for all the classes?


Most of Us have "good" scripts. We got them by reading that massive amount of "good" info....then we tested it out and made them Our own.

Good Luck and happy reading.

P.S. I have most classes in My DIYCE. Feel free to pick My limited brain, if you need help writing your own.
SirMasterBlue
Areafiftyone GL
Your roving muse reporter
K60/R60
Artemis

1,353

Friday, December 26th 2014, 2:42pm

Question 1:
What does "custom:" do in K/M diyce and in general?

PHP Source code

1
name "Custom: Holy Strike",        use = (pctEB1 >= .05) and (not tbuffs["Light Seal III"]) },



Why not just ( name = "Holy Strike", Use = ...)


Question 2:
What diyce will do with "function: cancelbuff" in this particular example?


PHP Source code

1
name "Function: CancelBuff",    use = (pbuffs[501797]), params = {"Mana Shield"} },


1,354

Friday, December 26th 2014, 5:54pm

Question 1:
What does "custom:" do in K/M diyce and in general?

PHP Source code

1
name "Custom: Holy Strike",        use = (pctEB1 >= .05) and (not tbuffs["Light Seal III"]) },



Why not just ( name = "Holy Strike", Use = ...)


Question 2:
What diyce will do with "function: cancelbuff" in this particular example?


PHP Source code

1
name "Function: CancelBuff",    use = (pbuffs[501797]), params = {"Mana Shield"} },



As far as I can remember "Custom" allows you to check GCD and use the shift key to bypass skills. (I could be wrong)

As for Holy Strike using Light Seals, the Knight has several skills that stack Light Seals or Holy Seals now.

I can only hazard a guess as to the CancelBuff. I took that piece of code out of My DIYCE. I would think it stops the HP drain caused by Mana Shield.

I hope I didn't muddy the waters too much.
SirMasterBlue
Areafiftyone GL
Your roving muse reporter
K60/R60
Artemis

1,355

Friday, December 26th 2014, 6:46pm

"Custom: " calls the following function, where action = name of skill.

PHP Source code

1
2
3
4
5
6
7
8
9
10
function CustomAction(action)
    if CD(actionthen
        if IsShiftKeyDown() then Msg("- "..actionend
        g_lastaction action
        CastSpellByName(action)
        return true
    else
        return false
    end
end


So Custom checks the cd of the skill. If the skill is ready for use, it then posts a message in default chat window with the name of the action being used only when the shift key is held down, then records what the skill name in the g_lastaction variable.

This is useful to prevent spamming the same skill repeatedly such as for holy light domain :

Source code

1
{ name = "Custom: Holy Light Domain",	use = (pctEB1 >= .05) and (not tbuffs["Holy Illumination"]) and ((tbuffs["Light Seal I"]) or (tbuffs["Light Seal II"]) or (tbuffs["Light Seal III"])) and (g_lastaction ~= "Holy Light Domain") },


Here we see that it calls custom, so it will record "Holy Light Domain" in the g_lastaction variable when it is casts. If we come to that skill on the very next button press of Diyce, g_lastaction ~= "Holy Light Domain" will be false (~= is "not equal to") so it won't cast again.

If you want to use a Custom skill more then one time, you'll want to use at least 2 Custom: calls. If you only have 1 Custom: call, once the skill is activated the first time, g_lastaction will ALWAYS be the same thing, so it will always return false after the initial cast. That is why Holy Strike is also a Custom call -- eventually g_lastaction = "Holy Strike" and so the requirements for holy light domain become true and it will eventually recast.

Cancelbuff....cancels a player buff.

Source code

1
{ name = "Function: CancelBuff",    use = (pbuffs[501797]), params = {"Mana Shield"} },


This cancels the buff "Mana Shield" when the use requirements are met. Namely when you hae buff 501797


This post has been edited 1 times, last edit by "BlankMinded" (Dec 26th 2014, 6:55pm)


1,356

Friday, December 26th 2014, 6:52pm

g_lastaction

The funny thing is, I don't use the Custom and do use the g_lastaction to build a fairly sequential prioritized CE.

Source code

1
2
3
4
5
6
7
8
 { name = "Charge",			        	use = (pctEB1 >= .05) },
 { name = "Shadow Step",		        	use = (EnergyBar2 >= 60) and (not behind) },
 { name = "Threaten",					use = (pctEB1 >= .05) and (not (tbuffs[500241]) and (tbuffs[500169]) and g_lastaction ~= "Holy Strike") },
 { name = "Punishment",				        use = (pctEB1 >= .05) and (tbuffs[500169]) and g_lastaction ~= "Threaten" },
 { name = "Strike of Punishment",			use = (pctEB1 >= .05) and (tbuffs[500169]) and g_lastaction ~= "Punishment" },
 { name = "Disarmament",				use = (pctEB1 >= .05) and g_lastaction ~= "Shadow Step" and not g_lastaction ~= "Holy Strike" and (not (tbuffs[500165]) or (tbuffs[500157]) or (tbuffs[500158]) or (tbuffs[500159])) },
 { name = "Shock",			        	use = (pctEB1 >= .05) and (tbuffs[500165]) },
 { name = "Holy Strike",		        	use = (pctEB1 >= .05) and (not tbuffs[500169]) },
SirMasterBlue
Areafiftyone GL
Your roving muse reporter
K60/R60
Artemis

This post has been edited 1 times, last edit by "SirMasterBlue" (Dec 26th 2014, 7:04pm)


1,357

Friday, December 26th 2014, 6:59pm

The version of Diyce I have only references that variable during a Custom: action call. I don't know if subsequent version changed use, and I'm sure that users can make use of that variable easily as well.

1,358

Friday, December 26th 2014, 7:06pm

The version of Diyce I have only references that variable during a Custom: action call. I don't know if subsequent version changed use, and I'm sure that users can make use of that variable easily as well.


My version has been heavily modified. I read a lot here and there. ;-)
SirMasterBlue
Areafiftyone GL
Your roving muse reporter
K60/R60
Artemis

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

1,359

Sunday, December 28th 2014, 12:13am

IIRC, g_lastaction was implemented as a way to tell what the previous action used was. It is a global variable so tghat it could be checked in the use clause of the skill list if desired (or in other locations).

I can't really remember the reasoning for the "Custom:" actions, but needless to say, as Ghostwolf implemented it, he obviously deemed it worthy.

The "Function:" type stuff was a modification to DIYCE 2 that I made to allow calling pretty much any Lua function you can think of. The name of the function you want to call comes after the "Function:" while the parameters to the function are in the special "params" clause. So taking that example:

Source code

1
{ name = "Function: CancelBuff",    use = (pbuffs[501797]), params = {"Mana Shield"} },

This is equivalent to saying (in Lua)

Source code

1
2
3
   if pbuffs[501797] then
      CancelBuff("Mana Shield")
   end

But of course, it is done via the skill list.


While on the subject of functions, something that isn't taken advantage of much but can be handy is that the use clause need not be this massive list of ands and ors. You can instead merely provide the name of a Lua function and DIYCE 2 will call that function in order to determine if it should use the skill or not. Of course, the function itself would still need to perform the various checks, but it can be done in a cleaner way.

Anyway, if you want to try, the function should have no parameters and should return a true or false value. Here's an example using the "Disarmament" skill line posted above:
This:

Source code

1
{ name = "Disarmament",				use = (pctEB1 >= .05) and g_lastaction ~= "Shadow Step" and not g_lastaction ~= "Holy Strike" and (not (tbuffs[500165]) or (tbuffs[500157]) or (tbuffs[500158]) or (tbuffs[500159])) },


could be re-written as:

Source code

1
{  name = "Disarmament"				use = CheckDisarmement },

with the following function added:

Source code

1
2
3
4
5
6
7
8
function CheckDisarmament()
  if pctEB1 >= .05 and g_lastaction == "Holy Strike" then    -- Slight optimization of the g_lastaction checks
    if not tbuffs[500165] or tbuffs[500157] or(tbuffs[500158] or tbuffs[500159] then
      return true
    end
  end
  return false
end
2013... The year from hell....

1,360

Sunday, December 28th 2014, 12:31am

CheckDisarmament

Hi Peryl

I'll give that a shot. Thank you. The way I have it written was the only way I could get it to stack at the time. I'm still getting the hang of Lua. Your tips and tutorials are a major help. Along with ALL the other folks that have helped over the years.

While I have your ear, I was wondering a few things. Could you give an example of how to see which player is currently playing (I.E.: local = UnitIsUnit(player) --Use this to determine which foodbuff/pots to use.) I thought I saw someone working on a foodlist once, but, can't seem to find it.

Thanks in Advance.

*Not so much an example...just a nod if I am heading in the right direction.*


Just FYI. It works like a charm, Peryl. Thank you very much!

P.S. I removed the extra ( from the "tbuffs" line.
SirMasterBlue
Areafiftyone GL
Your roving muse reporter
K60/R60
Artemis

This post has been edited 3 times, last edit by "SirMasterBlue" (Dec 28th 2014, 1:27am) with the following reason: I post too often