#Re equipping items

48 messages · Page 1 of 1 (latest)

candid matrix
#

The video speaks for itself. My items are re equipping when they should not be. However, an interesting thing I found, was then when I removed the code that allowed me to skip performance, suddenly, this issue would dissappear, just like that, and my code works just fien after that.
As you can see, my performance skip code is completely untied to my code for checking the debuffs on Dysangelos, which is quite interesting to wonder how its connected.

#

I also skipped out anything in my code that had

/*

*/

If you noticed any jumps

#

Also, right to left for going top to bottom for my code

quaint escarp
#

use rune swords dual wield smh

candid matrix
#

Ohp, thats a bad video, but I can get another of the first phase if you would like

quaint escarp
#

anyways this isn't much of a bug more than a stonescript issue so

candid matrix
#

But whats the problem with my code?

quaint escarp
#

there's most likely some bug in your code

quaint escarp
#

ask in #stonescript

candid matrix
#

I rewrote the code slightly different for the same checks, and ended up with the same result

atomic mica
#

i didnt look closely but i notice you have a lot of code paths that end in an else-if, which means if the condition is false, it does nothing after that. this could be leading to situations where your code doesnt try to equip anything that frame

#

generally you always want it to be defined in the code what should be equipped at any moment

candid matrix
#

It is always defined

#

But that wouldn't explain why this happens only whenever I have perf skip code written, which is somewhat unrelated to what should be equipped that frame

rich turtle
#

equip and activate commands are skipped if its the same ones as the previous frame, the animation canceling code means it changes each attack so it has to re-run, this causes interruptions if you equip multiple weapons to a hand within a frame and may make it retry an activation that was impossible when the code ran.

#

also you are manually starting by changing the loadout, that should be a hint that something is wrong with your code.

#

For instance, ai.enabled returns a boolean, not the string "True", though it may do some type conversion.
do ?ai.enabled ! true
or ?!ai.enabled

candid matrix
rich turtle
#

referring to you swapping the equipment manually several times during the vid, like the start of the fight

candid matrix
#

The only two things that are running and chnaging equip are perf skip, which Ice never had a problem with, and a poison wand equippinh when the boss does not have the desired debuff

rich turtle
#

just looking at the code you posted, you also have the bardiche section running most of the time, but replacing the equip before it can stay in hand for a frame to activate, so it keeps interrupting the other equips every time aac makes equips re-run

candid matrix
#

Hmmm, you may be right

rich turtle
#

if you had used ?item.CanActivate() instead, it would at least have gone on cooldown and not interrupted the rest, though as written it will just get interrupted by the other stuff

candid matrix
rich turtle
#

you need to prevent the other equips from running when trying to use an ability that can get interrupted, this is where the :? is useful

#

I recommend putting all equip commands as part of the same :? chain or nested within it

#

so that you can put the activate earlier in the :? chain, which blocks the rest from running

rich turtle
#

they do different things

candid matrix
#

Oh

#

Wait, how do they do different things? Shouldnt one just be a specified item?

rich turtle
#

item.CanActivate() checks if abilities are enabled globally, i.e not in a cinematic and similar

#

item.CanActivate(id here) checks if that specific ability can be used right at that moment, which among other things check that its equipped, and this equip check is 1 frame behind because equip and activate doesn't run until the entire code is finished

candid matrix
#

Interesting

#

So I should just make both checks on the same line of code / frame?

rich turtle
#

you dont need item.CanActivate(id here) in most situations

#

you already checked cooldown and set the equip

#

you just need to check that its not in a cinematic or similar that disables abilities

candid matrix
#

Luckily I have that

rich turtle
#

You do need something that keeps bardiche equipped for the duration of the cast though, which blocks the other equips if using :?

#

The tutorial uses 2 cooldown checks, but using item.right and item.right.state is more flexible

#
?foe.distance < 9 & item.CanActivate()
^& item.GetCooldown("bardiche")<=0
^| item.right="bardiche"
^& item.right.state=2
  equip bardiche
  activate R
candid matrix
#

Ah, using the item state to wait until its finished, but not hold it om forever, clever