Not able to adventure

Winterbay

Active member
I've no idea if this is a Mafia bug or something else but at the moment I can't do any auto-adventuring. Every time I try I get the message:
Code:
You can't use this script right now.
Come back after rollover.

It doesn't matter if I run a script, a CLI-command line (ash adv1()) or just use the autoadventure feature.

Any idea what is going on?
I've attached a debug log in case that helps.

Edit: The first part was when I forgot to remove the proxy-tick box for the proxy at work.
 
Last edited:

Veracity

Developer
Staff member
You are running a script which attempts to make SHC drinks.
You have no still usages available.
The script told you to try again after rollover.

If you don't like that behavior, I suggest that you stop running that script.
 

Winterbay

Active member
Ahh, thanks. I was almost certain I had removed that part of the script already, will go change that now then :)
 

Bale

Minion
"You can't use the script right now" should be replaced by the reason you can't use the script. Useful error messages help prevent user error, even when the user is the programmer. :)
 

Fluxxdog

Active member
Hmm... I see why. The script he's using is mine. The script is no longer intended to be imported but instead called independently. It's not a bug, it's a feature, otherwise it can drain a person's meat account by always buying ingredients. I put the abort checks in to prevent that when running the script solo. In the bBS script line that I put on the front page to use with the script, it checks first and foremost if it has stillls available so that the script doesn't run unless you actually can make SHC drinks.
If the line:
if(stills_available()>0) cli_execute("supredrinks");
...is put in that bBS script instead of importing, it'll function exactly as it should.
 
Last edited:

Winterbay

Active member
Hmm... I see why. The script he's using is mine. The script is no longer intended to be imported but instead called independently. It's not a bug, it's a feature, otherwise it can drain a person's meat account by always buying ingredients. I put the abort checks in to prevent that when running the script solo. In the bBS script line that I put on the front page to use with the script, it checks first and foremost if it has stillls available so that the script doesn't run unless you actually can make SHC drinks.
If the line:
if(stills_available()>0) cli_execute("supredrinks");
...is put in that bBS script instead of importing, it'll function exactly as it should.

Ahh, thanks. I searched the script but couldn't find a single abort() which confused me slightly. I'll change my import to your suggestion.
 

Fluxxdog

Active member
Ahh, thanks. I searched the script but couldn't find a single abort() which confused me slightly. I'll change my import to your suggestion.
Glad I could help. ^^ The reason you couldn't find an abort is because I used vprint(,,0) I swear, if it weren't for zlib, I'd probably not gotten in to scripting.
 

Winterbay

Active member
RIght. Inoticed the vprint but thought that a 0 only was to make sure it got printed no matter how low the verbosity was set at :)
I haven't looked at the functions in zlib at all :)
 

slyz

Developer
@Fluxxdog: maybe you should consider using abort() or vprint("",0) only for real problems, and have your script use "exit" or "return" if the player doesn't have any more stills to use.
 

heeheehee

Developer
Staff member
exit exits out of a script. For whatever reason, it's not on the wiki under Control Structures. Interesting.
 

StDoodle

Minion
For whatever reason, it's not on the wiki under Control Structures. Interesting.

Reason = it doesn't get listed by ashref. ;) Seriously, if it wasn't already on the wiki, and didn't show up with ashref, the chances are small of anyone thinking to add it. Thankfully, it appears that slyz is on top of things.
 

Fluxxdog

Active member
return=ends a function
abort=stops KoL (and prints an error message)
Does exit stop ALL automation or just the script it's called from? Little fuzzy there. Say I have an exit in a bBS script, will it still keep adventuring?
 

StDoodle

Minion
I'm not 100%, but my impression is:

return = exits the current control structure
abort = exits all automation w/ an error state & message
exit = exits all automation w/o error state or message
 

slyz

Developer
Exit simply exits from the current script without stopping the automation, but I think you might want to do some testing for yourself to find out what is meant exactly by 'the current script', especially when you are importing scripts.
 

StDoodle

Minion
Ok, I just did some testing, and my assumptions on use of exit appear to be correct. When used in a function in testB.ash that was called in testA.ash, none of the commands in testA.ash that followed the call to testB.ash's function with "exit" were executed, nor was anything in the imported function after the "exit" executed from testB.ash.
 

Fluxxdog

Active member
OK, slyz, I got yer testing.

When exit is imported into a script, it is treated exactly as being part of that script, which will call a full stop to the script and the script ONLY. It does NOT stop automation. If it is used in a bBS, it will still adventure automatically after the exit command is hit. abort() causes a full stop, exit does not. This can be quite useful, as you may want certain scripts to stop processing but not interfere with automated adventuring. The only caveat is whether you've imported the exit into a script or used cli_execute("call <script>") as the former brings the entire script to a halt and the latter simply stops the called script and continues on in the first script. I updated the wiki more simply than this. (If anyone can make it clearer, please go right ahead.)
Two little quickies to test:
PHP:
import <exittest.ash>;
print("Test Start");
cli_execute("call exittest.ash");
testexit();
print("Test End");
...and this would be exittest.ash:
PHP:
void testexit(){
print("This is the test!"); exit;}
void main(){
testexit(); print("exit didn't work!");}
You should get:
Code:
Test Start
This is the test!
This is the test!
 
Last edited:
Top