Feature New ash command: boolean cli_cmd(string cmd, string parameter);

Bale

Minion
boolean cli_cmd(string command, string parameter)
- Executes the named CLI command with the given parameter.

Since ash automatically coverts parameters to strings I could use the ash command cli_cmd("concert", $effect[Winklered]);

This might seem unnecessary since we have the command cli_execute(), but I admit that cli_execute() does the same purpose, but it does have an advantage for the ASH programmer. One of the many reasons I prefer ash to cli is that it validates the program before execution so that small errors like typos are caught. Unfortunately cli has none of that. I'm not suggesting that cli_cmd() would check the parameter for validity since that would be a rather troublesome snarl, but it should check the command to see if it is a valid cli command. After that, the fact that many parameters are items or effects would provide some validation checking for the scripter.

I hope that the devs would not think that this feature would be more troublesome to create than it's value is worth.
 
I'm sure I'm missing something, but how is that different than cli_execute("concert " + $effect[Winklered])? I do agree that coding it like that is safer.
 
I'm sure I'm missing something, but how is that different than cli_execute("concert " + $effect[Winklered])?

That is actually what I am doing now. It is different only in two ways. The coding is prettier and it would check "concert" against the list of valid cli commands.
 
and it would check "concert" against the list of valid cli commands.

How? Are you expecting a "random" function call to get an exceptional treatment from ASH validation?
Or is the only thing you are concerned with "do not apply aliases"?

Either way, I suspect what you *actually* want is an ash function for each cli command that doesn't have it yet.
 
Either way, I suspect what you *actually* want is an ash function for each cli command that doesn't have it yet.

Well, that *is* what I actually want, but it seems like an excessive request since it would be a lot more work and this would fulfill 90% of what I want.
 
In a entirely unscientific survey, I found the 15 most common commands called with cli_execute() on same arbitrary set of scripts I have.
Code:
225 trigger
217 conditions
163 outfit
151 make
112 use
110 mood
87 florist
74 checkpoint
58 maximize
52 uneffect
50 refresh
46 goal
46 camp
41 cast
33 equip
I'm not claiming this list is useful. I was just curious.
 
Why would you use cast, equip, make, use or maximize? Those all have fully functional ASH equivalents!

refresh has refresh_shop(), refresh_stash() and refresh_status() which have fulfilled almost all my refreshing needs, but there are a few others. There should probably be refresh_all() and refresh_quests() also.
 
Why would you use cast, equip, make, use or maximize? Those all have fully functional ASH equivalents!
I know I found the list very amusing. Many times it was "use *". The fact that it's shorter than doing it in ash is not a good reason.

Among the subset of scripts I have installed, BCC ascend and CC ascend are the most significant abusers of cli_execute() . Here's the counts from BCA alone:
Code:
94 trigger
31 use
25 outfit
21 make
20 mood
12 mcd
10 cast
9 maximize
7 goal
6 zap
6 equip
6 condition
5 refresh
5 goals
4 untinker
4 uneffect
4 set
4 checkpoint
4 buy
3 restore
3 conditions
3 closet
3 acquire
2 familiar
2 dvorak
2 create
2 alias
1 unequip
1 telescope
1 summon
1 speculate
1 skeeball
1 leaflet
1 hermit
1 hatter
1 friars
1 concert
1 call
1 adv
 
Back
Top