Hi, I decided to make a script for extracting primes so that I wouldn't have to call the same command for each prime.
My plan was to have a function I would call 'extp' that would setup some variables and extract salt, then have a trigger run a script when I regain balance to extract sulphur then mercury. Code is below as it's not very big.
Function extp:
if (!client.extp) client.extp = {}; client.extp.extracting = true; client.extp.prime = 'salt'; client.send_direct('extract ' + client.extp.prime);
Script for the trigger:
if(client.extp.extracting) { if(client.extp.prime == 'salt') { client.extp.prime = 'sulphur'; } else if(client.extp.prime == 'sulphur') { client.extp.prime = 'mercury'; } else if(client.extp.prime == 'mercury') { client.extp.prime = 'salt'; client.extp.extracting = false; } client.send_direct('extract ' + client.extp.prime); }
The problem I am having is that when I attempt to use the command the function runs fine but the trigger's script is throwing errors
Error in Trigger Script [extpTr]:
ReferenceError: personal is not defined
and none of it is run. I can see nothing wrong with my code so would like to get another opinion. Thanks.
EDIT: If it is helps the reflex package these are in is called 'Personal'.
Comments
Check at your typo, and remember "personal" is different of "Personal". I believe this can be the issue.
Ah, I got this working by changing the variables to be stored at client.personal.NAME
Thanks for the help
Haha, next problem.
My next step to finishing this off was to have the trigger be enabled and disabled when needed.
I'm currently using:
From what I can tell it is correctly enabling the trigger, however the trigger doesn't seem to go off at all now!
What I did for this was just use a sequence of commands under the alias "extp", and let them run. The key is "config usequeueing on" from the config menu. This allows multiple commands to be put in the balance queue. I have to trigger it in each room, so I currently use a button for that. It runs, gives me a bunch of spam about waiting for balance to be restored, and lists all of the commands still left in the queue, until it is all done. Including in-rifting, it takes about 10 seconds per room. As long as there is no combat, it works great.