ScriptUO

Scripting Resources & Utilities => OEUO => OpenEUO Scripting Chat => Topic started by: Jonasbengt on September 30, 2014, 10:20:50 AM

Title: Need alittle help
Post by: Jonasbengt on September 30, 2014, 10:20:50 AM
Hi there, im trying to lern/do a own script for a super easy thing. but i can find where to start, so i thought id just ask

Im looking for something like, this.

on hotkey Z
use item x
if no item of that kind then print "funny comment here"
waitforcursor/waitfor target
else wait for journal secret word
when right word said in journal
target last target.

And ofc i want this in lua for openeuo :D

If you just want to give me some hints/something to start off that would be awsome! :D


Post Merge: September 30, 2014, 12:39:07 PM
Ive looked around and ive stolen some here and there to get something going. Ive made it so that i can use the item! :D progress!

But i have no idee on how to do the journal thing, and i have no idee on how to make the script go back and wait for me to use the hotkey again. it just stopps after 1 use =(
Title: Re: Need alittle help
Post by: Endless Night on October 13, 2014, 04:28:12 AM
post your code
Title: Re: Need alittle help
Post by: KaliOfLS on May 07, 2015, 04:56:09 PM
Code: [Select]



--on hot key

if getkey('z') then
    while getkey('z') do wait(1) end --have fun if you forget this. 
    UO.ScanItems(false)
    local nCnt = UO.FilterItems(2,xType)
    if nCnt < 1 print("funny messages :D :D :D LOL") else
       UO.LObjectID = UO.GetItems(0)
       UO.Macro(17,0)
       local ref,cnt = UO.ScanJournal(0)
       local timer,err = getticks()+500,3
       while not UO.TargCurs do
          if err < 1 then break 
          elseif timer < getticks() then
              UO.Macro(17,0)
              timer,err = getticks()+500,err-1
          else wait(50) end
       end
       local msg = false       
       while not msg do
           ref,cnt = UO.ScanJournal(ref)
           for i = 0, cnt-1 do
                local line = UO.GetJournal(i)
                if line:match("Secret Code!") then msg = true break end
           end   
       end
       --UO.LTargetID = sometarget or is it already set
       UO.LTargetKind = 1
       UO.Macro(22,0)
    end
end