ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: vanzelus on June 04, 2014, 11:21:46 AM
-
Hi,
Am trying to get this script snippet to scan the journal so that when disco fails it'll loop back and try again but if disco succeeds it'll stop trying to disco the target. I got the first part to work but the second part when disco succeeds the script won't stop and continue to disco the target even though the target is already discorded. I'm not well versed in scanjournal so maybe that's where my problem is. Please advise; again the goal is to keep looping when disco failed but stop looping when disco succeeds. Thanks.
Set %discord #false
heal:
If #FINDCNT > 0 && #HITS > 81 && #MANA > 50 && %PETS_KILL = #TRUE && %Cast_Wait_Timer <= #sCnt2
{
cmppix 1 f
{
Event macro 15 28 ; cast Greater Heal
Target 5s
click 1412 736
wait 10
}
}
If #FINDCNT > 0 && %PETS_KILL = #TRUE && %DISCORD = #FALSE
{
SET #LTARGETID %TARGET_FOUND
Event macro 13 15 ; use skill Discordance
Target 5s
Event macro 22 0 ; last target
scanjournal 1
if fail in #journal
{
deleteJournal
wait 2s
goto heal
}
if another_skill in #journal
{
deleteJournal
wait 2s
goto heal
}
if your_target's_strength in #journal
{
deleteJournal
Set %DISCORD #TRUE
wait 1s
goto heal
}
if that_creature_is_already_in_discord in #journal
{
deleteJournal
Set %DISCORD #TRUE
wait 1s
goto heal
}
}
-
I know you weren't asking about this but, for starters, you should consider changing your healing to targeting self instead of click location. I was also unsure about your use of cmppix, totally unnecessary.
Here's an example, but note that I may have mistakes here, I'm at work and going off memory:
If #FINDCNT > 0 && #HITS > 81 && #MANA > 50 && %PETS_KILL = #TRUE && %Cast_Wait_Timer <= #sCnt2
{
set #ltargetkind 1 ;<=== need to define targetkind when using target system
Event macro 15 28 ; cast Greater Heal
target 5s
event macro 23 0 ;<=== target self
wait 10
}
Now, on your question - here's the thing, you want to capture the #jindex value before you use discordance, then perform your actions, then scan EACH LINE of the journal that has changed since the last "synch" of the index.
You should also get rid of those "deletejournal" items, not necessary. Also you can see how I cleaned things up a little bit and made the code shorter.
For example:
If #FINDCNT > 0 && %PETS_KILL = #TRUE && %DISCORD = #FALSE
{
SET #LTARGETID %TARGET_FOUND
set %Index #jindex + 1 ;<=== sets a variable to the line following the current #jindex value
Event macro 13 15 ; use skill Discordance
Target 5s
Event macro 22 0 ; last target
if #jindex >= %Index ;<=== just make sure the the journal has new content before bothering to scan it
{
for %i %index #jindex ;<=== this for loop says "perform the following actions for all the lines of the journal that have changed
{
scanjournal %i ;<=== scans the index value given to %i in the for loop
if fail in #journal || another_skill in #journal ;<=== you really don't need this anyhow since you aren't doing anything with it
goto heal
if your_target's_strength in #journal || that_creature_is_already_in_discord in #journal
{
Set %DISCORD #TRUE
goto heal
}
}
}
}
Hope this helps!
XII
-
I know you weren't asking about this but, for starters, you should consider changing your healing to targeting self instead of click location. I was also unsure about your use of cmppix, totally unnecessary.
Thanks for your respond 12x. The cmppix snippet is actually for pet healing; i know i can set #ltargetid as pet id and use last target to heal but was lazy and decided to just use the click location instead lol. But since you're touching on this topic as well, I want to ask a tangent question. How do you write a simple script that would drag pet's healthbar to a predetermined x y coordinate? I looked at a lot of script on easyuo on how to do this and they all don't seem to have a concrete answer or just a bit too much code. Would this example work?
set %pet #ltargetid
execevent drag #ltargetid
conposx 1412
contposy 715
Don't dock me too much for this, I just pulled this out of my head without looking up all necessary codes. I just want a simple code, not anything complex, to pull pet's healthbar to a predetermined location without having to drag it by hand every time. Thanks again for your input.
-
Hmmm...not sure, haven't done that before. Maybe someone else will weigh in.
XII