Author Topic:  (Read 5245 times)

0 Members and 1 Guest are viewing this topic.

Offline Crome969Topic starter

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
« on: August 03, 2011, 11:59:38 PM »
0
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.

Offline gimlet

  • Very Super Secret
  • Global Moderator
  • *
  • *
  • Posts: 6206
  • Activity:
    3.2%
  • Reputation Power: 71
  • gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!gimlet is awe-inspiring!
  • Gender: Male
  • Respect: +274
  • Referrals: 3
    • View Profile
« Reply #1 on: August 04, 2011, 07:31:24 AM »
0
nice - thanks!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
« Reply #2 on: August 04, 2011, 11:38:20 AM »
0
I love useful snippets like this.  Thanks for sharing.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Crome969Topic starter

  • Elite
  • *
  • *
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
« Reply #3 on: August 04, 2011, 01:22:25 PM »
0
I love useful snippets like this.  Thanks for sharing.
It was a pleasure :)
More Snippets and Scripts coming soon.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
« Reply #4 on: August 18, 2011, 06:18:24 AM »
0
sweetness... love it
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Tags: