Time function?

pagboy

New member
Hello, I am new to this forum.

I am thinking of writing a script that adventures every 5 - 10 seconds in a pre-defined Ultra-rare area. This would (hopefully) make UR-hunting easier.

My question: Is there a function that allows delay between adventures? If so, then what is the syntax?

I apologize if this question has been answered before.

-pagboy
 

Bale

Minion
delay x

It will delay for x seconds, if x is an integer. There is only the CLI command, not ash.
 

Spiny

Member
It's my understanding that you'd make use of cli_execute() to perform a cli command in a .ash script.

-Spiny
 

pagboy

New member
Would this work for the script (high-level):

Code:
while(adventuresRemaining > 40){
[INDENT]adventure(1, hauntedBilliardsRoom);
cli_Execute(delay 3);[/INDENT]
}

The adventures.txt file on the KolMafia site says that the Haunted Billiards Room is adventure=109; so would that make the adventure() code:

Code:
adventure(1, adventure=109);
or
Code:
adventure(1, 109);
?

Additionally, what is the variable that defines how many adventures are remaining? I checked the scripting wiki, but it pushed a virus at me, while Firefox and my antivirus pestered me about it.

Thank you for the answers thus far.
 

Grotfang

Developer
I would use

Code:
int my_adventures()

Also, try using

Code:
$location[Haunted Billiards Room]

The entire script (according to me - I may be wrong somewhere) would be:

Code:
int adv = my_adventures();

while(adv > 40)
{
adventure( 1 , $location[Haunted Billiards Room] );
cli_Execute( "delay 3" );
}

Note the quotation marks surrounding delay.
 

pagboy

New member
I used this script:

Code:
int adv = my_adventures();

while(adv > 40)
{

adventure( 1 , $location[Haunted Billiards Room] );
cli_Execute( "delay 3" );

}

and got the following return:

Code:
> call scripts\URHunter.ash

Visit to Manor1: Haunted Billiards Room in progress...

[1371] Haunted Billiards Room
Encounter: chalkdust wraith
Strategy: attack with weapon
Round 0: pagb0y wins initiative!
Round 1: pagb0y attacks! (auto-attack)
Round 2: pagb0y attacks!
Round 3: pagb0y attacks!
Round 4: pagb0y attacks!
Round 5: pagb0y attacks!
Round 6: pagb0y attacks!
Round 7: pagb0y attacks!
Round 8: pagb0y attacks!
Round 9: pagb0y attacks!
Round 10: pagb0y attacks!
You acquire an item: handful of hand chalk
You gain 2 Strengthliness
You gain 3 Mysteriousness
You gain 1 Roguishness

No available namespace with function: delay

It then stopped. I am using KolMafia 13.2. Directly inputing "delay 3" through the CLI returned the same error.
 
Last edited:

pagboy

New member
Worked great. Thank you all for your advice! I'm going to polish the design a bit, then post it as a full script.
 

dawdawdo

Member
That script works? It looks like that while loop will never end because the adv variable is initialized once, and then neverchanges. If it does indeed work, then ignore this, but I would suggest instead:


while(my_adventures() > 40)
{
adventure( 1 , $location[Haunted Billiards Room] );
wait(3);
}

In fact, a for loop would probably be even better since it hits the server less often (I assume my_adventures() hits the server every time).

I feel like I may be missing something... but it looks like your problem is solved anyway. : )
 

Bale

Minion
mafia keeps track of my_adventures() internally and whenever the character pane refreshes, it is checked. It is not a server hit.
 
Top