Official Nodeka Board  

Go Back   Official Nodeka Board > Nodeka > Scripting > JMC

Reply
 
Thread Tools Display Modes
  #1  
Old 04-10-2010, 06:33 PM
Jilporanth Jilporanth is offline
Wanderer
 
Join Date: Apr 2010
Location: Firestone, CO
Posts: 3
Question Sleeping and waking, how to change?

Hello, and thanks in advance for humoring me asking a second question before my first is even answered, but I think this one ya'll might be able to help me with.

When I run a script with nembot, it sleeps before each tick, and maybe even at other times. It does NOT sleep under any other circumstances. What I want to do is have it so that it only sleeps before a tick if hp < 60%, for example, and then to sleep if hp < 30% until hp is 90% or greater. I'm not asking for someone to write the code; although I am not very familiar with Javascript, I already wrote a script, valk.js, to skillup my valk, by looking at footie.js -- however I haven't been able to tweak it to satisfaction, but that's for another thread.

What I'm asking for, really, is just for some direction, i.e. what file do I need to edit, and where in the file will I find the relevant code, and if possible, what code I can write to replace the sleep/wake thing without breaking nembot. As for the more ambitious project of sleeping with HP low, I will try to figure that out on my own.

As soon as I get valk.js fixed, I will post it here, it's not terribly useful since a nonremort valk has only 3 buffs that i'm aware of, but still is cool. And Im proud of myself for writing it, heh.

Again, thanks for reading. I look forward to your replies.

-Jilporanth
Reply With Quote
  #2  
Old 05-30-2010, 05:03 PM
Jilporanth Jilporanth is offline
Wanderer
 
Join Date: Apr 2010
Location: Firestone, CO
Posts: 3
Post Solved!

To turn off sleeping, you can use the following command:

#scr nembot_vars['script']['sleep'] = '-1' (apostrophes optional around -1)

however, it will only work until you end the current script. I solved this by aliasing /begin to the following:

#scr nembot_begin();#scr nembot_vars['script']['sleep'] = -1

and '/beginsleep' just does #scr nembot_begin(); in case you actually need to sleep on ticks.
If you want to change it in-game, set the value to 2. Easiest thing is to create another alias that aliases the above command to e.g. 'sleepset', but minus the value, so "sleepset -1' would turn off sleeping, 'sleepset 2' would turn it on. Or leave the = off if you want, but it's nice to not have to type that long string every time you start a script.

I'm still working on the kinks, but this works well.

Another way to sleep on ticks outside of nembot is set an action to sleep on "#10 seconds to tick" and wake on "#tick". Another action to turn it off.

Thanks to the post 'Nembot actions in Nembot commands', would never have figured this out without it.

(can use /debug to check what state your sleep is set to if in doubt.)

Happy insomniac scripting!
-Jilporanth
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:23 PM.


Design By: Miner Skinz.com
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.