Need some explanations about RoM and LUA

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: Need some explanations about RoM and LUA

#41 Post by Zangetsu »

BillDoorNZ wrote:I suspect you are trying to do a few things which is where we are getting confused.

From what I can tell, you wanna use this 'function' to push data into the DB. So you would kill a mob, see what it drops and use this stuff to add that to the database.

at some later point, you will use all that info to help build your waypoints etc and determine which files to use when your 'bot' is queried.

Is that right? or am I getting to confused now too?

Well I will try to explain better then (english isn't my birth language, that's prolly why you have some difficulties to understand me, sorry.)


WORKING
* Bot is executing function via LUA scripts I've made (still hacky and ugly, but I will rewrite these better once I get the other part working :p)
* X <time> MM is executing a function (LUA script) that checking the database and returning all new "orders" if there is new orders
* Then MM is executing these new orders because it's LUA scripts too
* The bot will do what MM is saying

It can be a looooot of things like:
Farm here, farm there, stop fighting, go quest, etc...

* Using a website that update database (then if the bot is working atm, it will do "new things" since the "orders" have been updated)
* On the website you can get whispers, some check like "Do I have enough free space in my bag?" "How much SomeItem I have?"
* On website you can also answer to whispers by example and the bot will automatically see a new whisper and execute the function, etc...

* On another PC on your legit char, you can see whispers your bot just get by example

NOT WORKING
When playing on another PC and another char, I want to make it possible to give new "orders" without quitting what I'm doing and having. For that I need from the game to "send commands" that MM could understand and execute. (EventMonitor was the last idea)

Maybe it's better this way xD

Well, it's just a few of all ideas I have, but if I tell all you won't read it :lol:
User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: Need some explanations about RoM and LUA

#42 Post by Zangetsu »

BillDoorNZ wrote:you could possibly also automate the whole thing by looking at the way lootomatic and lootfilter++ auto-loot from corpses. That way, when they open the loot frame and do their thing, you could grab a list of the loot and the mob and then send that.
Don't stick on this feature ;) This is just a "part" of the whole project and this is working with EventMonitor anyway :lol:
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Need some explanations about RoM and LUA

#43 Post by rock5 »

This thread has grown really fast. I can't be bothered reading it all but I just wanted to point something out, if it hasn't already been.

If you use "registerTimer" then you need to "yield" control so that the timer code can run. You yield with a "yrest". So those first onload examples had no yrests so never execute the timer code. Ideally if you don't want the code to do anything else, then you will need to create a loop with yrests in it. Also, that's why trying to set up a timer via the commandline wont work, if you've ever tried it. The commandline doesn't yield while waiting for user input. To try out a timer via the commandline, after setting it up, you would have to enter a yrest to get the timer event to run.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: Need some explanations about RoM and LUA

#44 Post by Zangetsu »

Yeah rock5, thanks for the tip, Bill and Lisa gave me this idea already. Honnestly the main problem now, is the loop "g" input and chat input closing that I'm trying to fix with Bill's idea. Because "master" side, we need to play the game and MM is only here to "grab" inputs.
User avatar
Zangetsu
Posts: 56
Joined: Fri Nov 11, 2011 5:45 pm

Re: Need some explanations about RoM and LUA

#45 Post by Zangetsu »

My project is going pretty well, I postponed the "sending commands from the game on another char/anotherPC" to later because it's too much headache and it's stopping m development. I'll check this later.

For now I can parse all the chatlog with the famous and amazing work of rock5 with EventMonitor functions. It's updating the database, so I can see what's "chatting" on every chans that EventMonitor can "parse".

From my frontend (Internet WebApplication) I can answer to these channels and the bot will answer. (Some trouble with special chars like é, è, ç, etc... I think it's due to MM not working with UTF8 file prolly)

From my frontend still, I can send RoM API commands and the bot is executing it. Like InviteByName("Player") ad the bot will invite the specified player.

But now I'm trying to make it executing MM functions. I don't want to do something like this:

Code: Select all

If Command == "loadPath" then
	loadPaths(Path);
elseif Command == "SomethingElse" then 
	AnotherMMFunction(Args);
elseif....

...
end
Because it will do a lot of "if", "elseif" and I don't like it. I want to do it "automatically"
With ROM API function, it's kinda easy because we can use RoMScript()

So my question is:
Is there an equivalent of RoMScript() for MM? Like MMScript("MMFunction(args);")

If not, do you have another idea?
I can explain it better if it's not clear.




EDIT
Hmm, I think I have an idea. Tell me if it could work.

Code: Select all

function MMScript(function, args);
	return function(args);
end


MMScript("MyFunction", "arg");


EDIT 2
Nvm, found a way with loadstring, it's working actually. Sorry for the noise :lol:
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Need some explanations about RoM and LUA

#46 Post by rock5 »

I would have advised looking at commandline.xml for a simple example. It also deals with syntax errors and doesn't let them stop the script.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
Post Reply