Transfer variable

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
zbynio
Posts: 36
Joined: Thu Feb 04, 2010 8:16 am
Location: POLAND

Transfer variable

#1 Post by zbynio »

Hi
Any know how do I pass a variable from script in game to script in the bot?

;)
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Transfer variable

#2 Post by rock5 »

zbynio wrote:Hi
Any know how do I pass a variable from script in game to script in the bot?

;)
I use something like that in fastlogin_revisited.

The in-game script uses a variable "loginNextToon" to tell it if it hould login your next character.

I read that value from the bot like this;

Code: Select all

value = RoMScript("LoginNextToon")
and change it like this;

Code: Select all

value = true
RoMScript("}LoginNextToon="..tostring(value)..";a={")
  • 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
zbynio
Posts: 36
Joined: Thu Feb 04, 2010 8:16 am
Location: POLAND

Re: Transfer variable

#3 Post by zbynio »

a very cool way - thank you @rock5
but...
this is boolean
i need:
in-game script (addon) set a long alphanumeric string and read it in the script bot

ex.:
in addon mystring need as global <-- I dont know how make this

Code: Select all

function myAddOn.setHello() 
      mystring = "hello world 12345";
      return mystring;
end
in bot <-- work fine

Code: Select all

value = sendMacro("myAddOn.setHello();");
addMessage(value);
User avatar
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: Transfer variable

#4 Post by Administrator »

Type shouldn't mater for this. I'm fairly certain that strings work.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Transfer variable

#5 Post by rock5 »

zbynio wrote: in addon mystring need as global <-- I dont know how make this
Just declare the string outside of any functions, usually at the top of the file.
eg.

Code: Select all

mystring = "";
Actually I just had a an idea. If you want to use a function;

Code: Select all

function myAddOn.setHello(variable)
      return variable;
end
With this function you can return any global variable in the game.

For instance you want mystring, just use;

Code: Select all

value = sendMacro("myAddOn.setHello(mystring);");
But I'm pretty sure my example would have worked with any value. Easier too.
  • 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