Page 1 of 1
Adding New command
Posted: Tue Apr 19, 2011 9:09 pm
by Uniden65
Is there a way you could add in a new code to ..run for so many hr or min then log off or dc ?
Re: Adding New command
Posted: Tue Apr 19, 2011 9:55 pm
by rock5
The easiest way to do it is in the onLoad section of the waypoint file, add
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.
Re: Adding New command
Posted: Wed Apr 20, 2011 11:58 am
by lisa
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" />
Re: Adding New command
Posted: Wed Apr 20, 2011 9:21 pm
by rock5
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.
Re: Adding New command
Posted: Mon Apr 25, 2011 5:10 pm
by Uniden65
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 ?
Re: Adding New command
Posted: Mon Apr 25, 2011 7:22 pm
by rock5
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.
Re: Adding New command
Posted: Tue Apr 26, 2011 6:41 pm
by Uniden65
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
Re: Adding New command
Posted: Tue Apr 26, 2011 10:05 pm
by rock5
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.