Ok... so how do you do it?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Ok... so how do you do it?

#1 Post by Romplayer »

I've been spending the last 4 hrs trying to write a WP file for the TB public events. I got the actual questing done in the first 10 mins but I lack the programming / API call knowledge to be able to recognize the Event triggered in CHAT_MSG_SYSTEM. I downloaded the eventwatcher addon but i can't translate the code that displays simply the string to my WP file which is thru a if event == "Regional event now restarting!" then

All i basically want is to sit at the WP until the condition is true then completequestbyname()
If u could tell me how to call ROM addons / variables thru the bot that would help. Or if u have a basic working code that would be better. Or even how to make a global variable in the Rom addon that can be accessed by the rombot.
Help me pretty please.....
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Ok... so how do you do it?

#2 Post by lisa »

I can't find this TB public Event addon anywhere, if you can link it or post I can translate it.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#3 Post by Romplayer »

i can't post cuz of spam but it isn't a TB event addon it is a general event handler thing
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#4 Post by Romplayer »

well heres the event.lua theres also a xml file for it

Code: Select all

EventWatch_events = {}

local eventWatchFrame = nil
local DEFAULT_COLOR = "50a6ee"

function EventWatch_OnLoad(this)
    eventWatchFrame = this
    this:RegisterEvent("VARIABLES_LOADED")
    --[[
    this:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
    this:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN")
    this:RegisterEvent("BAG_ITEM_UPDATE")
    this:RegisterEvent("BAG_UPDATE_COOLDOWN")
    this:RegisterEvent("BILLBOARD_OPEN")
    this:RegisterEvent("CANCEL_LOOT_ROLL")
    this:RegisterEvent("COUNTDOWN_START")
    this:RegisterEvent("FOCUS_CHANGED")
    this:RegisterEvent("FSF_UPDATE")
    EventWatch_AddEvent("GARBAGE_UPDATE")
    this:RegisterEvent("GRF_UPDATERESOURCE")
    this:RegisterEvent("IMF_ITEM_UPDATE")
    this:RegisterEvent("INSPECT_INTRODUCE_UPDATE")
    this:RegisterEvent("ITEMQUEUE_CLEAR")
    this:RegisterEvent("ITEMQUEUE_INSERT")
    this:RegisterEvent("ITEMQUEUE_UPDATE")
    this:RegisterEvent("PLAYER_BAG_CHANGED")
    this:RegisterEvent("PLAYER_TARGET_CHANGED")
    this:RegisterEvent("SKILL_UPDATE")
    this:RegisterEvent("SKILL_UPDATE_COOLDOWN")
    this:RegisterEvent("TB_UPDATE")
    this:RegisterEvent("TP_EXP_UPDATE")
    this:RegisterEvent("USE_CRAFTFRAME_SKILL")
    --]]
    DEFAULT_CHAT_FRAME:AddMessage("EventWatch loaded. Commands: /watch <event> [color], /unwatch <event>, /watches")
end

function EventWatch_OnEvent(this, event, ...)
    local printEvent = true
    
    if event == "VARIABLES_LOADED" then
        printEvent = false
        for k, ev in pairs(EventWatch_events) do
            this:RegisterEvent(ev[1])
            if ev == "VARIABLES_LOADED" then
                printEvent = true
            end
        end
    end
    
    if printEvent then
        local i = 1
        while arg[i] ~= nil do
            event = event .. "," .. arg[i]
            i = i + 1
        end
        local color = DEFAULT_COLOR
        for k, ev in pairs(EventWatch_events) do
            if event:find(ev[1]) == 1 and ev[2] then
                color = ev[2]
            end
        end
        DEFAULT_CHAT_FRAME:AddMessage("|cff" .. color .. "Event: " .. event .. "|r")
    end
end

function EventWatch_AddEvent(frame, eventName)
    local space = eventName:find(" ")
    local color = DEFAULT_COLOR
    if space then
        color = eventName:sub(space + 1, -1):gsub(" ", "")
        
        -- color must be 8 hex digits, and the 2 alpha are preset to ff
        if color:len() ~= 6 then
            color = DEFAULT_COLOR
        end
        eventName = eventName:sub(1, space - 1)
    end
    eventName = eventName:upper():gsub(" ", "")
    
    -- Check for duplicates
    for k, ev in pairs(EventWatch_events) do
        if ev[1] == eventName then
            return
        end
    end
    
    eventWatchFrame:RegisterEvent(eventName)
    table.insert(EventWatch_events, {eventName, color})
    SaveVariables("EventWatch_events");
    DEFAULT_CHAT_FRAME:AddMessage("Watching for |cff" .. color .. eventName .. "|r events.")
end

function EventWatch_RemoveEvent(frame, eventName)
    eventName = eventName:upper()
    if eventName == "ALL" then
        for i, v in ipairs(EventWatch_events) do
            eventWatchFrame:UnregisterEvent(v[1])
        end
        EventWatch_events = {}
        DEFAULT_CHAT_FRAME:AddMessage("Not watching any events.")
    else
        eventWatchFrame:UnregisterEvent(eventName)
        for i, v in ipairs(EventWatch_events) do
            if v[1] == eventName then
                table.remove(EventWatch_events, i)
                DEFAULT_CHAT_FRAME:AddMessage("No longer watching for " .. eventName .. " events.")
                break
            end
        end
    end
    SaveVariables("EventWatch_events");
end

function EventWatch_PrintWatches(frame, eventName)
    DEFAULT_CHAT_FRAME:AddMessage("EventWatch is watching for these events:")
    for i, v in ipairs(EventWatch_events) do
        DEFAULT_CHAT_FRAME:AddMessage("- |cff" .. v[2] .. v[1] .. "|r")
    end
end


SLASH_EVENT_WATCH1 = "/watch"
SlashCmdList["EVENT_WATCH"] = EventWatch_AddEvent

SLASH_EVENT_UNWATCH1 = "/unwatch"
SlashCmdList["EVENT_UNWATCH"] = EventWatch_RemoveEvent

SLASH_EVENT_WATCHES1 = "/watches"
SlashCmdList["EVENT_WATCHES"] = EventWatch_PrintWatches
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Ok... so how do you do it?

#5 Post by lisa »

out of those events only 1 looks like a possible for the event.
TB_UPDATE
I searched and couldn't find the addon anywhere.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#6 Post by Romplayer »

i sent u a pm
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#7 Post by Romplayer »

i think i got it crudely. I wrote a function into the addon to just return the string and i called it within the WP file using RoMScript and it seems to work. Thanks though. hope u got the pm Lisa.

turns out the string is "|cffffff80Regional event now restarting!|r"
prolly from the addon but it works and thats all that matters. im too lazy to parse the extra data plus i prolly don't know how :mrgreen:
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Ok... so how do you do it?

#8 Post by lisa »

Romplayer wrote:Thanks though. hope u got the pm Lisa.
Hmm nope no PM's today
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#9 Post by Romplayer »

instead of dissecting the code i added

Code: Select all

function getevmessage()
	return TB1;
	end
at the end of the EventWatch.lua

I even tried to make a userfunction

Code: Select all


function TBevent()
	local TBES = RoMScript('getevmessage()')
	if (TBES == "|cffffff80Regional event now restarting!|r") or (TBES == "|cffffff80Regional event has ended.|r")  then
		TBE = TBES
		end
	end	


function startTBevent()
	registerTimer("TBevent", secondsToTimer(5) , TBevent);
end

function TBcheck()
	if TBE == "|cffffff80Regional event now restarting!|r" then
		return TBE
	elseif TBE == "|cffffff80Regional event has ended.|r" then
		return "false";
	end
end
i donno if this will work but it would be usefull to onload on the WP file with startTBevent()

the thing is u have to enter /watch WARNING_MESSAGE or /watch CHAT_MSG_SYSTEM into the chat before it will work.
Last edited by Romplayer on Tue Feb 14, 2012 9:47 am, edited 1 time in total.
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#10 Post by Romplayer »

lisa wrote:
Romplayer wrote:Thanks though. hope u got the pm Lisa.
Hmm nope no PM's today
ok resent it. pretty sure it worked this time
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#11 Post by Romplayer »

oh and i also added TB1 = arg

Code: Select all

    if printEvent then
        local i = 1
        while arg[i] ~= nil do
		TB1 = arg[i]            
        event = event .. "," .. arg[i]
            i = i + 1
        end
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#12 Post by Romplayer »

edit: done
Last edited by Romplayer on Sat Feb 18, 2012 6:05 pm, edited 1 time in total.
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#13 Post by Romplayer »

but its still not as cool as your event timer counter lisa
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#14 Post by Romplayer »

ok after a few days of tinkering i made this rough copy of the EventWatch.lua and xml. This is a ROM addon goes in interface/addons and it is a conditional type of Event watch for TB event. So u can replace the event watch.lua and xml or add it into a .toc file. The return TBmessage() is borked but i beleive that all it needs is

Code: Select all

TBM = arg[1]
where TBM = event
TB.lua

Code: Select all

edit
TB.xml
[codeedit[/code]

so when event restarts TBGet() returns a 1
when event ends TBGet() returns a 0
can be called in WP file with RoMScript('TBGet()') being a value of 1 or 0

I wish i knew how to program this in a userfunction file. maybe I'll try again but i still don't know how to use eventmonitor,etc. I tried earlier but it was a nil somewhere and crashed Rombot. my only reference to event handling was from the GMdetector.

BTW i learned that CHAT_MSG_SYSTEM uses different values or different arg b/c i couldn't get the right msg to post. and the TBmessage() would just be blank. i donno maybe it was a color problem. so WARNING_MESSAGE uses just one arg1. easy peasy
Last edited by Romplayer on Sat Feb 18, 2012 6:07 pm, edited 1 time in total.
Romplayer
Posts: 120
Joined: Wed Jan 11, 2012 10:07 am

Re: Ok... so how do you do it?

#15 Post by Romplayer »

i give up trying to make a userfunction.. i just don't get how the monitorevent works
Post Reply