ScriptUO

Scripting Resources & Utilities => OpenEUO Scripts => OEUO => OEUO Snippets => Topic started by: Crome969 on August 03, 2011, 11:59:38 PM

Title:
Post by: Crome969 on August 03, 2011, 11:59:38 PM
Good Morning Community,
today i will give out some snippets of my Baselibrary.
Some are easy, some are small.. maybe some will help.

Cloning #scnt and #scnt2:

Code: [Select]
--################################--
--@scnt()
--@Purpose : Returns CurTime in Seconds
--################################--
function Scnt()
nHour,nMinute,nSeconds,nMiliSeconds = gettime()
return ((nHour*3600) + (nMinute*60)+nSeconds)
end
--################################--
--@scnt2()
--@Purpose : Returns CurTime in MiliSeconds
--################################--
function Scnt2()
nHour,nMinute,nSeconds,nMiliSeconds = gettime()
return (((nHour*3600) + (nMinute*60)+nSeconds)*10)+nMiliSeconds
end
tried to copy the #scnt and #scnt2 from easyuo:)
example:

Code: [Select]
delay = Scnt()
if(Scnt()>Delay)then
--yourCode
end


Targeting like Target s in easyuo:


Code: [Select]
--################################--
--@WaitForCursor(timeout)
--@Purpose : Simplify Shouting
--################################--
function WaitForCursor(timeout)
tmptime = timeout * 1000
for mytimeout = 1, tmptime do
if(UO.TargCurs==false)then
wait(1)
end
end
end
same function like "target 1s" is possible.
example:
Code: [Select]
WaitForCursor(5)will wait until TargCurs = true or maximum 5 seconds. Helpfull for Scripts wich use targeting via Spells or such things.

Gather Bag of Sending ID :

Code: [Select]
--################################--
--@GetBagofSending(timeout)
--@Purpose : Simplify Shouting
--@Attention! dont work Standalone!
--@Library needet : Kal In Ex Finditem
--################################--
function GetBosID()
tmp=ScanItems(true,{Name="A Bag Of Sending"},{ID=IT})
if(#tmp==0)then
print("No Bag Of Sending found get a Bag and Press play again")
pause()
GetBosID()
end
return tmp[1].ID
end
You will need Kal in Ex Finditem to use this.
Example :
Code: [Select]
BOS = GetBosID()returns ID of Bag of Sending in Backpack in BOS

Find out the Amount of Charges at BOS
Code: [Select]
--################################--
--@GetBagofSendingCharges(ID)
--@Purpose :Returns Amount of Charges of BOS
--################################--
function GetBagofSendingCharges(BosID)
sName,sInfo = UO.Property(BosID)
b,c =string.find(sInfo,"Charges: ")
c = c + 1
return (string.sub(sInfo,c,#sInfo))
end
Simple, you want to refill your Bos when its smaller than x uses? just ask via function how many uses you have left!:)
Example:
Code: [Select]
Charges = GetBagofSendingCharges(BOS)
print(Charges)


Weight and Maxweight interactions:
If you want to make interactions when you nearly reach your maxweight:
Code: [Select]
--################################--
--@function WeightoverLimit(Factor)
--@Purpose : Returns true if Weight > % of Maxweight
--################################--
function WeightoverLimit(Factor)
if(UO.Weight>(UO.MaxWeight*(Factor/100)))then
return true
else
return false
end
end

Example:
Code: [Select]
WeightoverLimit(69)It checks if your Weight is bigger than 69% of Maxweight.
Title:
Post by: gimlet on August 04, 2011, 07:31:24 AM
nice - thanks!
Title:
Post by: TrailMyx on August 04, 2011, 11:38:20 AM
I love useful snippets like this.  Thanks for sharing.
Title:
Post by: Crome969 on August 04, 2011, 01:22:25 PM
I love useful snippets like this.  Thanks for sharing.
It was a pleasure :)
More Snippets and Scripts coming soon.
Title:
Post by: Endless Night on August 18, 2011, 06:18:24 AM
sweetness... love it