ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Paulonius on June 27, 2010, 10:59:21 AM
-
I have been working on a script that uses exevent dropPD for a while now and looking at an alternative as a work around because of the inconsistency with dropPD.
After looking at some other scripts and doing some experimenting, I think that the snippet below has a lot of potential. I am using a drag, opening the paperdoll, and then using a click with move cursor. It seems to be working a lot of the time. However, I am coming up short with a test for when it fails. When it doesn't work, it typically picks up the item and holds it on the cursor, but doesn't drop it. If I could check the cursor to see if the thing is still there, then I could try the click again as a failsafe. The best way I see of doing that is from the #Cursorname variable, that says drag_gump when it is holding something. It doesn't have an ID though. Is there a way to confirm whether or not the cursor is carrying something? I will play with this some more and report back, but figured I would put it out there to see what folks think.
Event Drag %ItemToEquip
Wait 15
event macro 8 1 ; paperdoll
wait 20
Gosub OffsetClickMC 100 120
Wait 15
If #Contname = drag_gump
{
Gosub OffsetClickMC 100 120
Wait 15
}
-
http://wiki.easyuo.com/index.php/LLiftedKind
Then you have the #lliftedtype and #lliftedid to use to help you out. :)
-
Thanks Twinkle McNugget, that is helpful. May be the same as the #CONTNAME check I was using, but I like it better.
Okay, so here are the subs I am testing. The first is one where I really need the item equipped because its a weapon. The second is one for items that I want equipped, but it would be alright if it missed once or twice in the cycle of other things. These are running in the midst of another script that is healing with aids constantly and has the potential to interfere with the drag/click-drop.
I will update after I test it a bunch.
Really want to get it equipped (weapon):
;==========================================================
Sub EquipWeapon
Set %Equipped No
Set %EquipType %1
Set %EquipFromSecure No
Set %EquipItemFound No
Set %EquipTimeout1 #Scnt2 + 250
Set %EquipTimeout2 #Scnt2 + 500
Finditem %EquipType C_ , #BackpackID
If #findcnt < 1
{
Set %EquipFromSecure Yes
Finditem %EquipType C_ , %Secure
}
Else
{
Set %ItemToEquip #findid
Set %EquipItemFound Yes
}
If #findcnt > 0 && %EquipFromSecure = Yes
{
Set %EquipItemFound Yes
Set %ItemToEquip #findid
exevent drag #findid
Wait 15
exevent dropc #BackpackID
Wait 15
}
If %EquipItemFound = No
Return #False
Set !HealPause On
Wait 15
Repeat
{
If #lLiftedKind = 0
{
event drag %ItemToEquip
wait 15
}
event macro 8 1
Wait 20
Gosub OffsetClickMC 100 120
wait 10
finditem %EquipType C_ , #CHARID
If #FindCnt > 0
Set %Equipped Yes
If %EquipWeaponTimeout1 >= #Scnt2 && %Equipped = No
{
gosub TM_CheckBackpack 610 610
gosub TM_CheckPaperdoll 810 510
}
}
Until %Equipped = Yes || %EquipWeaponTimeout2 >= #Scnt2
If #lLiftedKind = 1
{
event macro 8 1
Wait 20
Gosub OffsetClickMC 100 120
wait 10
}
Set !HealPause OFF
If %Equipped = Yes
Return #True
Return #False
Want it equipped, but its not urgent:
;==========================================================
Sub EquipArmor
Set %EquipType %1
Finditem %EquipType C_ , #BackpackID
If #findcnt < 1
{
Finditem %EquipType C_ , %Secure
If #findcnt < 1
{
Event exmsg #charid 3 4 You are out of Armor Item Type %1
Return #False
}
}
Set %ItemToEquip #findid
Set !HealPause ON
Wait 15
Event Drag %ItemToEquip
Wait 15
event macro 8 1 ; paperdoll
wait 20
Gosub OffsetClickMC 100 120
Wait 10
If #lLiftedKind = 1
{
Gosub OffsetClickMC 100 120
wait 10
}
Set !HealPause OFF
Return
-
This is a great time for you to learn namespaces Paul. Copying variables between namespaces is easy, and you can basically set the state of the equipping sub to "on" and while it's on you can have the healing pause. I have a looting/healing/attacking sub that is in 2 scripts, and while the looting is drag/dropping to pack, the healing pauses, so while I'm healing/attacking, I'm looting in between... it works pretty great if you can time things right. Normally doing other things while looting is a bad idea, but if you get everything right, and make sure you DONT move while doing it, you can do some pretty amazing stuff. :)
-
Namespaces make me all warm an tingley! ;)
-
So many people just don't get them because they don't think they're needed but you don't really start doing powerfull stuff till you learn namespaces. :) And they aren't hard at all, just a lot of people don't take the time to learn them so they're perceived as being difficult. They're not. :) Think of them like seperate ziplock baggies for variables. Each ziplock bag can hold an infinite amount of variables that don't affect any other ziplock bag of variables. And you can copy variables between any ziplock bag... :) I especially like using unique namespace names that allow you to use the same namespace but keep it seperate from other tabs. Example:
set %namespaceName PaulsNamespace , #clinr
namespace push
namespace global %namespaceName
namespace clear
YOUR CODE HERE
namespace pop
Say you're using this script on 3 seperate clients, all the variables on the seperate clients will be the same, but they are kept seperate by the namespace and the variable #clinr, but since it's easy to know what client you're in, it's easy to copy variables between the clients this way because you know when you're swapping between clients, exactly what client you're in with the #clinr variable.
-
On a Side note... are you using
event macro 58 0
for healing yourself? If you have the new targeting system on you can effectively bandage yourself & no Target cursor is generated using that Event macro. It would interfere less with Cursors & might help with Drags/drops...
Just an idea (if you weren't using it already)....
-
I am not using heal self as the script is based on cross healing.
-
Actually Paul you can do "select nearest party member" then bandage selected.
-
And that doesn't pull up a target cursor either?
Is there a macro for select that you can drop an ID into? I like this for cross healing if it doesn't use the targetting cursor, would be powerful.
Looking at macros 58 and 59 now. I will do some testing, that looks like it would rock in a cross heal script. The only issue I see for the script I am working on now is that I am using bandages from a secure and I think 58 and 59 require aids in your backpack.
Just tested it out, you can use bandages from any source that you used them from previously and they don't need to be in your backpack. I am going to convert my cross heal script over to setting the target and using event macro 59. This will really help my script function more smoothly, thanks guys.