03-22-2012, 02:26 PM
I figured I'd share a few injection subs which may be useful to people learning the syntax and/or weak and new pvpers who want a little advantage to help them out.
The first is a sub which will always choose to use a scroll for a spell, but if no scrolls are available it will switch to use the book spell. This is useful for spells where the scroll is superior in all ways to the book (e.g. bless, poison, cure, wall of stone and so on)
If you wish to use it for other spells simply rename the sub, change the itemID and spell name to that of the spell you wish to use.
If the spell is one you wish to target someone (or yourself) automatically then you need to add one of the two following lines in the blank spaces I have left in the above script:
You can also target objects and other fanciful things but I'm keeping things simple for now.
Next up I have a little program which I run (it loops itself automatically) which constantly keeps me apprised of my health and mana. This helps if you (like me) hate the UO status bar and find the minimised version too inaccurate:
You will need two keys to operate it properly:
You can tweak the numbers to change how frequently the mana and life messages are sent. It may not be useful to everybody but I hope even those who aren't interested in these specific scripts can use them to steal ideas/syntax information.
Next, I have a single press mana drinking button, this button calculates the amount of mana you need and drinks the most appropriate mana potion. Again, should you wish you can change the thresholds at which it chooses. It also notifies if you are out of a certain potion type and will opt to drink the remaining type rather than leave you without mana:
Note that this is not a loop, it is a single-press single-drink sub.
I also suggest all Injection users, particularly those who are using smooth walk, make a "fix Injection weirdness" button, this can solve any targeting malfunctions (if lots of wait attacks pile up because of a flaw in your scripts this can be pretty bad) and resync the client. Here is mine:
My final little script is a very simple one, to arm your shield during your bandage macro (be warned it can leave you open to being para with shield up if you aren't careful!)
You need to set your shield type (by itemID) at the top of your main routines. Alternatively you could also rescript to use shield as an object instead. The wait(250) in this script serves the purpose of preventing your shield dropping straight back in your pack because of the bandage (e.g. if you lag even slightly).
Anyway, that's all for now. I've seen a lot of people asking for Injection help, particularly for PvP. I am not a pro (in fact I suck) but I thought I'd share a little of what I've learned and hopefully it'll be useful to somebody. I may add some more stuff later, but I'm not going to give away all my tricks
The first is a sub which will always choose to use a scroll for a spell, but if no scrolls are available it will switch to use the book spell. This is useful for spells where the scroll is superior in all ways to the book (e.g. bless, poison, cure, wall of stone and so on)
Code:
sub WallofStone()
if uo.count(0x1F44) > 0 then
uo.print("Casting using scroll.")
uo.exec("usetype 0x1F44")
else
uo.print("Casting using spell.")
uo.exec("cast 'Wall of Stone'")
endif
end sub
If you wish to use it for other spells simply rename the sub, change the itemID and spell name to that of the spell you wish to use.
If the spell is one you wish to target someone (or yourself) automatically then you need to add one of the two following lines in the blank spaces I have left in the above script:
Code:
uo.waittargetself() ; target yourself automatically
uo.waittargetlast() ; target last automatically
You can also target objects and other fanciful things but I'm keeping things simple for now.
Next up I have a little program which I run (it loops itself automatically) which constantly keeps me apprised of my health and mana. This helps if you (like me) hate the UO status bar and find the minimised version too inaccurate:
Code:
sub MonitoringSystem()
var h = 50 + (uo.str / 2)
var cm = uo.int
uo.print("The health and mana monitoring system is enabled.")
REPEAT
if uo.life <= h - 5 then
uo.print(str(uo.life)+ " HITPOINTS remaining")
else
if uo.life >= h + 5 then
uo.print(str(uo.life)+ " HITPOINTS remaining")
endif
endif
h = uo.life
if uo.mana < cm - 5 then
uo.print(str(uo.mana)+ " MANA remaining")
cm = uo.mana
else
if uo.mana > cm + 5 then
uo.print(str(uo.mana)+ " MANA remaining")
cm = uo.mana
endif
endif
wait(1000)
UNTIL uo.life == 0
uo.print("You are dead. The Monitoring System is disabled.")
end sub
You will need two keys to operate it properly:
Code:
; set the hotkey to start the script to:
exec MonitoringSystem
; set the hotkey to stop the script looping to:
terminate MonitoringSystem
You can tweak the numbers to change how frequently the mana and life messages are sent. It may not be useful to everybody but I hope even those who aren't interested in these specific scripts can use them to steal ideas/syntax information.
Next, I have a single press mana drinking button, this button calculates the amount of mana you need and drinks the most appropriate mana potion. Again, should you wish you can change the thresholds at which it chooses. It also notifies if you are out of a certain potion type and will opt to drink the remaining type rather than leave you without mana:
Code:
sub Mana()
if uo.int - uo.mana > 36 then
if uo.count(0x0F0D, 0x387) > 0 then
uo.usetype('0x0F0D', 0x387)
else
if uo.count(0x0F09, 0x388) > 0 then
uo.usetype('0x0F09', 0x388)
else
uo.print("Out of all mana potion types!")
endif
endif
else
if uo.int - uo.mana > 20 then
if uo.count(0x0F09, 0x388) > 0 then
uo.usetype('0x0F09', 0x388)
else
if uo.count(0x0F0D, 0x387) > 0 then
uo.usetype('0x0F0D', 0x387)
else
uo.print("Out of all mana potion types!")
endif
endif
else
uo.print("You don't need more mana you greedy fool!")
endif
endif
end sub
Note that this is not a loop, it is a single-press single-drink sub.
I also suggest all Injection users, particularly those who are using smooth walk, make a "fix Injection weirdness" button, this can solve any targeting malfunctions (if lots of wait attacks pile up because of a flaw in your scripts this can be pretty bad) and resync the client. Here is mine:
Code:
sub Resync()
uo.say(chr(27))
if uo.waiting() == 1 then
uo.canceltarget()
endif
uo.resend()
uo.print("Resync complete.")
end sub
My final little script is a very simple one, to arm your shield during your bandage macro (be warned it can leave you open to being para with shield up if you aren't careful!)
Code:
var shield = [YOUR SHIELD]
sub BandageSelf()
uo.exec("bandageself")
wait(250)
uo.usetype(shield)
end sub
You need to set your shield type (by itemID) at the top of your main routines. Alternatively you could also rescript to use shield as an object instead. The wait(250) in this script serves the purpose of preventing your shield dropping straight back in your pack because of the bandage (e.g. if you lag even slightly).
Anyway, that's all for now. I've seen a lot of people asking for Injection help, particularly for PvP. I am not a pro (in fact I suck) but I thought I'd share a little of what I've learned and hopefully it'll be useful to somebody. I may add some more stuff later, but I'm not going to give away all my tricks