Page 1 of 1

Timer Shown.. LOGOUT

Posted: Tue May 29, 2012 11:38 am
by Uniden65
Hey rock5 or lisa is there a way to show what you have the LOGOUT_TIMER set too when you start the bot ?

Code: Select all

		<!-- Log out and resurrect settings -->
<option name="LOGOUT_TIME" value="300" /> <!-- in minutes, 0 = timer disabled -->

Code: Select all

		<option name="LOGOUT_SHUTDOWN"		value="false" />
		<option name="LOGOUT_WHEN_STUCK"	value="false" />
		<option name="CLOSE_WHEN_STUCK"		value="false" />
		<option name="RES_AUTOMATIC_AFTER_DEATH" value="true" />
		<option name="MAX_DEATHS" value="10" />					 <!-- Log out after this many deaths -->
This option is very nice ....and i have looked for your Var. for LOGOUT_TIMER with no luck , something like a CPRINT in the start or the bot tell you what the timer is set too ? or NOT showing at all if its at default 0 ...

"The Bot will Auto Log in %d Minutes"

or let me know something about adding it to Profile ....I tryed

Code: Select all

cprintf(cli.red, "TIME BEFORE LOG OUT: %s\n\n Min", LOGOUT_TIME);
but with no luck, so i tryed to track down your Var. for LOGOUT_TIME... i could not find nothing

Re: Timer Shown.. LOGOUT

Posted: Tue May 29, 2012 11:48 am
by rock5
Profile "Options" are stored like this.

Code: Select all

settings.profile.options.LOGOUT_TIME
So you should be able to print that.

Re: Timer Shown.. LOGOUT

Posted: Tue May 29, 2012 1:49 pm
by Uniden65
thanks rock5 ..... Where does it store the Var. for the actual timer ..... the above will show me the time set ...Great added to /Onload command but i also would like to show time left after combat in profile? is this possible?

for anyone else who would like to see time set ....when bot starts add this to /onload

Code: Select all

	<onLoad><![CDATA[
		-- Additional Lua code to execute after loading the profile
		-- and before the bot starts. e.g. You could overwrite profile settings here
		-- like: changeProfileOption("HP_REST", 60);
		startGMDetect()
cprintf(cli.pink, "LOGOUT Time Set To: %s Min\n\n", settings.profile.options.LOGOUT_TIME);

Code: Select all

		if 999 > inventory:itemTotalCount("Runic Thorn") then
      		inventory:useItem(212183) -- Use Rune War Bow
      		  yrest(1000)
      		RoMScript("UseEquipmentItem(10);")
     		  yrest(1000)
      		inventory:useItem(212615) -- Use Fury of the Defender of the Jungle
      		  yrest(1000)

		if inventory:getAmmunitionCount() == 0 then
      		inventory:useItem(212185)
      			end
   		end

	]]></onLoad>

Re: Timer Shown.. LOGOUT

Posted: Tue May 29, 2012 2:07 pm
by rock5
Looking at the logout code it looks like it uses os.time. Might be easier to copy that and modify it.

Code: Select all

	if( settings.profile.options.LOGOUT_TIME > 0 ) then
		local elapsed = os.difftime(os.time(), self.BotStartTime);
		printf("Only %d minutes before logout.\n", settings.profile.options.LOGOUT_TIME - elapsed/60  )
	end

Re: Timer Shown.. LOGOUT

Posted: Tue May 29, 2012 2:17 pm
by Uniden65
I thought about changing that ...but if i do it would not be Svn correct why i added it to profile?

Re: Timer Shown.. LOGOUT

Posted: Tue May 29, 2012 2:26 pm
by rock5
I thought you might misunderstand. That's why I specifically said I'd "copy it". You misunderstood anyway. Oh well. Doesn't matter.

I meant I copied it instead of starting from scratch and you can use that in your onLeaveCombat to display the time left.

Re: Timer Shown.. LOGOUT

Posted: Tue May 29, 2012 2:29 pm
by Uniden65
thanks rock5 ill try this later off to work ........Your Ej scripts the best thanks for all the help

Re: Timer Shown.. LOGOUT

Posted: Tue May 29, 2012 11:30 pm
by Uniden65
no luck rock5 it errors out :attempt to index global self"

Re: Timer Shown.. LOGOUT

Posted: Tue May 29, 2012 11:38 pm
by rock5
Ooops. I even tested it but forgot that when I trested it I had to change self to player. Sorry.

So just change 'self' to 'player'.

Re: Timer Shown.. LOGOUT

Posted: Wed May 30, 2012 1:36 am
by Uniden65
yep that worked thanks rock5

Re: Timer Shown.. LOGOUT

Posted: Wed May 30, 2012 9:33 am
by Uniden65
this is what i finally added for anyone who would like to use it ...

Top of my /Onload i added

Code: Select all

		-- Shows Start of timer in hrs/min left before logout, only shown once on start
		if( settings.profile.options.LOGOUT_TIME > 0 ) then
      		    cprintf(cli.pink, "\n LOGOUT Time Set To: %d Hr.\n", settings.profile.options.LOGOUT_TIME/60);
      		    cprintf(cli.pink, "\n Or: %d Minutes In Profile\n\n", settings.profile.options.LOGOUT_TIME);
		end
and top of my onLeaveCombati added this to show timer count down after every kill ..

Code: Select all

		-- Shows time of timer, before logout
		   if( settings.profile.options.LOGOUT_TIME > 0 ) then
  		    local elapsed = os.difftime(os.time(), player.BotStartTime);
 		    cprintf(cli.red, "\n Only %d minutes before logout.\n\n", settings.profile.options.LOGOUT_TIME - elapsed/60  )
 		  end
Both work great together .... and thanks rock5