Variety of ways of doing the same thing.

in ash scripting using
Code:
use(1, $item[knob sausage chow mein]);
use(1, $item[bat wing chow mein]);
use(1, $item[rat appendix chow mein]);
or
Code:
cli_execute("eat 1 knob sausage chow mein");
cli_execute("eat 1 bat wing chow mein");
cli_execute("eat 1 rat appendix chow mein");
or
Code:
cli_execute("eat 1 knob sausage chow mein; eat 1 bat wing chow mein; eat 1 rat appendix chow mein");
Each method achieves the exact same thing.
if you are counting lines or bytes in your code, method 3 wins hands down.
If you insist on staying in ash and avoiding cli_execute, then method 1 wins.

Now I am wondering is one method better than another? What is everyones thoughts on this?
 

Sprinky

New member
I guess I can give my opinion on the way the code looks "visually"

My approach to coding is to make the code look as clean as possible, it's just the way I roll. Since you say they are all the same, I would go with the second approach.

That's my 2 cents.
 

macman104

Member
From what I've gathered, those will all be executed in the exact same way, there is no functional difference between them. The standard cli command and the ASH command invoke the exact same response in mafia. The only difference is how the information is initially entered.
 

Nightmist

Member
Dont forget you can drink and use chow meins either (Hahha yes drink a chow)

I would personally use number 1 since well ASH = use the proper ASH command if possible else resort to CLI commands and then if that fails move down to using url's in the CLI.
 
[quote author=Tirian link=topic=114.msg474#msg474 date=1145935604]
My first approach (being a Perl geek) was to add a function called "die" in my library that did the print-and-exit combo. Then, since the "then" part of the clause was a single command, I could dispense with the braces, which leads us to one of:
[/quote]

So... If I gather correctly, you have taken five lines of code, and turned them into 1 (or two) lines of code that calls a function that is... What? 5 lines long?

In essence, that adds 1 to 2 lines of code?

Now, I fully understand, and support, the thought that if you make the same call multiple times it is worth putting in a script...

But since that isn't what we are talking about, your example is doing the exact opposite of your argument.



And as for efilnikufecin's question:

I prefer all ASH. Even when a standard script would be less lines.

I prefer the functionality of ASH, and frankly I feel a little put out when I have to resort to cli_execute() even. It is a small price to pay to have ASH, and I pay it willingly. But since you asked my opinion.

((I prefer large and cumbersome, with easy eye-scanability over cramped and compact. After all, I paid for a fast CPU for a reason. Let my eyes take the break, not my computer hardware. ;) ))
 
[quote author=Tirian link=topic=114.msg476#msg476 date=1145939259]
That stream of understanding is easier to do when elementary functionality is abstracted and pulled out of the main function.[/quote]

Well, I for one would have to look up all function calls you make when going over your scripts. In this case, I'd have to actually download your library just to see what your function die did.

But I am like that. I would want to trace your entire script.

Like you said, different goats for different folks.
 
hmm, someone brought up printing a script. Ink is expensive hence:
Code:
cli_execute("eat 1 e cho; eat 1 bat g cho; eat 1 x cho");
Heck I don't know if that will work or not. There might be other items in the database that conflict with that method, but you get the point. Sure does make a script hard to read though. :p

Overall, I try to stick with ash, so method 1 is preferred by me.
 
Top