Adding New command

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Uniden65
Posts: 151
Joined: Thu Aug 20, 2009 5:17 pm

Adding New command

#1 Post by Uniden65 » Tue Apr 19, 2011 9:09 pm

Is there a way you could add in a new code to ..run for so many hr or min then log off or dc ?

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

Re: Adding New command

#2 Post by rock5 » Tue Apr 19, 2011 9:55 pm

The easiest way to do it is in the onLoad section of the waypoint file, add

Code: Select all

start_time = os.time()
and then somewhere, maybe at a safe location waypoint or in the onleaveCombat section of your profile or somewhere like that, check if the desired time has passed.

Code: Select all

if (os.time()-start_time) > 3600 then
   logoff()
end
It wont work in the onLoad section if the waypoint file if it's 1 of a set of alternating waypoint files that get loaded and reloaded. In that case you might have to initialize "start_time" in the onLoad section of your profile.
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Adding New command

#3 Post by lisa » Wed Apr 20, 2011 11:58 am

can't you just change the profile options to suit?

Code: Select all

		<option name="LOGOUT_TIME" 			value="0" />	<!-- in minutes, 0 = timer disabled -->
		<option name="LOGOUT_SHUTDOWN"		value="false" />
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

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

Re: Adding New command

#4 Post by rock5 » Wed Apr 20, 2011 9:21 pm

I think there are too many components to deal with. Do you want it to load the next character or not? Do you want to load a new profile or continue using the same one? Do you want to load a specific profile or the characters default profile? With automatic settings you could logoff anywhere while doing anything, if you do it in the waypoint file you can choose a nice safe place to logoff and include any other checks you might want to do before logging off. Then, of course, there is the fact that it requires Autologin to be installed.

All in all I think it would be more of a hinderance then a help. It's not like the code to relog is that long or complicated. That's what I think anyway.
  • 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

Uniden65
Posts: 151
Joined: Thu Aug 20, 2009 5:17 pm

Re: Adding New command

#5 Post by Uniden65 » Mon Apr 25, 2011 5:10 pm

so if iam adding these and i have a multi path for the first path i would use

Code: Select all

	<onLoad>
	start_time = os.time();
	</onLoad>
correct

for the other loaded paths off the first file could i use

Code: Select all

	<onLoad>
	start_time = start_time();
	</onLoad
so when it returns to the orginal path file time will stay constant??

would this work ?

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

Re: Adding New command

#6 Post by rock5 » Mon Apr 25, 2011 7:22 pm

If the first waypoint file loads a second waypoint file and so on and if the first waypoint file eventually gets loaded again then you can't have the start_time = os.time() in the onload section of the first waypoint file because it would get reset every time it gets reloaded.

In that case it would be better to put it in the onload section of the profile so that it only gets set when the profile is loaded which is only when starting the bot or changing characters and reloading the profile.

If you really want to add it to the first waypoint file you could also do something like this;

Code: Select all

if start_time == nil then
    start_time = os.time();
end
That way it should only do it the first time it loads the waypoint file.
  • 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

Uniden65
Posts: 151
Joined: Thu Aug 20, 2009 5:17 pm

Re: Adding New command

#7 Post by Uniden65 » Tue Apr 26, 2011 6:41 pm

please could you give a example ..on how to add it to profile?

i dont like adding it every time to my way points and then part to my profile and if it does not have the onload in the way point it crashes after it reaches this point in time ?

by then iam gone and i just stand there dieing

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

Re: Adding New command

#8 Post by rock5 » Tue Apr 26, 2011 10:05 pm

Initialize start_time in profile or waypoint file.
In Profile:

Code: Select all

<onLoad>
	start_time = os.time();
</onload>
Or Waypoint file:

Code: Select all

<onLoad>
if start_time == nil then
	start_time = os.time();
end
</onload>
Then at a safe place in your waypoint file check the time:

Code: Select all

	<!-- # 10 --><waypoint x="3929" z="3261">
		if (os.time() - start_time) > (60*60) then -- greater than 1 hour
			player:logout()
			error("Done for today. Logging off")
		end
	</waypoint>
You can do this at more than one 'safe' waypoint and in multiple waypoint files.
  • 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

Who is online

Users browsing this forum: No registered users and 0 guests