Help with "buy" or "acquire" for raffle tickets

babberton

New member
I've finally started to mess around with scripting and have been trying to create some login/out scripts with some inspiration from this thread and decided to code a logout section to buy 10 raffle tickets if I'm not in Ronin and don't already have 10 in my inventory.

With lots of help from the wiki I can now check if I'm in Ronin and check if I have 10 tickets in my inventory no problem but had major problems with actually buying the tickets.

I've finally solved the problem by using

PHP:
cli_execute ("raffle 10");

which is probably the worst option but it works so I'm happy.

Prior to this I tried using "buy" and "acquire" from within the script without success so started typing stuff straight in to the CLI to find a command that worked.

I'm wondering why the commands below bought punchcards instead of raffle tickets?

PHP:
> buy (10, raffle ticket)

Searching for "El Vibrato punchcard (104 holes)"...
Search complete.
Purchasing El Vibrato punchcard (SPHERE) (1 @ 49,968)...
You acquire an item: El Vibrato punchcard (SPHERE)
Purchases complete.
[raffle ticket)] has no matches.

> buy (10, item[raffle ticket])

Searching for "El Vibrato punchcard (104 holes)"...
Search complete.
Purchasing El Vibrato punchcard (SPHERE) (1 @ 49,969)...
You acquire an item: El Vibrato punchcard (SPHERE)
Purchases complete.
[item[raffle ticket])] has no matches.

> buy (10, item[785])

Searching for "El Vibrato punchcard (104 holes)"...
Search complete.
Purchasing El Vibrato punchcard (SPHERE) (1 @ 49,969)...
You acquire an item: El Vibrato punchcard (SPHERE)
Purchases complete.
[item[785])] has no matches.

I've probably made a stupid mistake somewhere but can't figure out what it is and wouldn't mind keeping hold of 150k meat in the future...

My preferences allow buying from NPC's and the mall if that helps at all?
 

Veracity

Developer
Staff member
You are trying to call ASH functions in the CLI. The only actually valid ASH function you tried was the second - "buy (10, item[raffle ticket]) ". But, it's moot, for a number of reasons.

- You cannot "buy" or "acquire" raffle tickets. You have to use the "raffle" command, as you noticed. That may be the "worst option", but since it's the ONLY option, I guess it's also the "best option", eh?
- It bought the El Vibrato punch cards because every one of your CLI commands was:

buy (10, ...something...

which tells KoLmafia to make two purchases: a "(10" and a "...something..."

The string "(10" unambiguously matches "El Vibrato punchcard (104 holes)", so, KoLmafia followed your instructions and bought one.

KoLmafia then failed to parse "...something..." as anything and printed the error message you saw.
 

slyz

Developer
For info, to use an ASH command from the gCLI:
Code:
ash buy(10, $item[raffle ticket])

It still won't work, but you get the point.
 
Top