Log in

View Full Version : Stack items on key press.



Ignatius
04-20-2007, 15:22
Greets,
just made that script cos i was too lasy to stack items by myself while playing ots.

I will give code and instructions for leechers and "how to do things like that" tutorial for more ambitious ppl.

:4leechers:
Script which you shoudl save in your proxy folder as stackOnKey.txt:


#stackItemsOnKey cavebot part
#~igi
:start
IfTrue ($__keypress$#number=#1) Goto $nlineoflabel:stack$
waitX 3
gotoScriptLine $nlineoflabel:start$
:stack
stackItems
fastExiva __keypress = 0
gotoScriptLine $nlineoflabel:start$


Now load stackOnKey.txt to cavebot,
Make new hotkey (PgDown for me) and set Command/actiontosay field to:

exiva __keypress = 1

voila, proxy should stack items when you press PgDown.
/:~

:Tutorial:
You want to make proxy stack items when you want it to do so.
It means that you have two problems to overcome. First, how to define procedure of stacking items and second, how to tell proxy that you want to stack items right now.
First problem can be solved using cavebot, second one can be solved using flag accessed from keyboard. If you don't want to read me playing 1337 haxor go to there.
Flag is a special kind of variable which can be accessed from diffrent parts of program or even multiple programs, which need to cooperate and share some info. Each flag position means something else, just like flag in the oldschool american-style mailbox.
For example: You are waiting for special letter. Thats why from time to time you check the mailbox status trough the window, hoping to see flag at the mailbox up.
"Flag is up" (flag== 1) says that you should check your mail (do something), and after doing it you put flag down (you set it to default, flag==0) so you wont go to empty mailbox again.
THERE
This scipt works with __keypress variable as a flag. position 0 means that key wasn't pressed. position 1 means that it was.
It is __keypress instead _keypress so that keypress is a global value and can be accessed from every part of the proxy.

Here will I will comment script line by line.

:start
// label for start of the main loop.
IfTrue ($__keypress$#number=#1) Goto $nlineoflabel:stack$
// checking if flag (__keypress in here) is up and redirecting
// to action when it is
waitX 3
//i don't want this program to lag my sucky comp. you can change
// 3 to lower value if you don't want such delay with stacking.
gotoScriptLine $nlineoflabel:start$
//end of the main loop here

:stack
stackItems
//stacking items here ;;
fastExiva __keypress = 0
//reseting flag to default to avoid endless stacking loop.
gotoScriptLine $nlineoflabel:start$
//going back to main loop.

Thanks for reading that crap,
Ciao
/:~

weeper
04-20-2007, 17:07
nice, I had one similar for same purpose but sometimes I get too lazy to share XD.

Adden_
04-20-2007, 17:56
Sweet!, Thanks :D

deer
04-20-2007, 22:05
Thanks :) Really well explained. Waiting for your next realase :rolleyes:

Arturpix
04-24-2010, 17:31
can this be made into a conditional event like each crtain time it stck items?

or can i put this for example a black knight script and the waypoints and everything else will work fine or do i have to put this script in cavebot alone?