Help - Search - Members - Calendar
Full Version: Trying to make a wielded weapon/wand verification
AC Tools Everything Macro > Other Scripting Tools > Skunkworks
Jscho32
I'm working on a script that uses different items for buffing/killing, and before each action I'm trying to add in a few lines to check the current wielded item verses a user defined item to be used in that situation, for example use 'Silver Tachi' for melee and 'staff' for mage. I used the skunkworks references and api constant database to try and figure this out, I'd like something like:



CODE
If (skapi.AcoFromEqm(eqmWeapons) == ("Silver Tachi"));        // see if wielded weapon is the user defined for melee
skapi.SetCombatMode(true);                                          // go into combat mode
        } else {                                                 // if not wielded weapon is not user defined
skapi.SelectAco("Silver Tachi");                                      // select weapon
skapi.Keys(cmidUSE);                                               // use weapon (wield)
skapi.SetCombatMode(true);                                       // go into combat mode
}




I get a syntax error on the } else { line. I don't really know what I'm doing, more like guess and check, this is my first project so I'm in the learning stage.
I used eqmWeapons because it looks like that is meant for any object in the weapon slot, missile/melee/wand, whereas eqmWeapon was for only melee/missile and eqmFocusWeapon was for wands etc, is this right?

Can anybody shed some light on my code and maybe give me a more efficient way of checking current wielded item, seeing if it is the correct one, and wielding a new weapon if not? Also is there a way to select and use a weapon without requiring AC to be the active window? I read that skapi.Keys(cmid) requires ac to be the active window...
GKusnick
Your syntax error is probably the result of the fact that you have a } without a matching {. Also, case matters in JScript, so "if" should be spelled in all lowercase. If you're not familiar with the basics of JScript, you should read the JScript documentation.

aco.Use() will use an item without requiring the Use keystroke. You don't need to select the item first.
Jscho32
CODE
WeaponAco = skapi.AcoFindInInv("Silver Tachi");
if (WeaponAco != null) {
WeaponAco.Use();
}



Thanks greg =)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.