New Mafia feature?

Would it be possible to add a few new features that would look like
Code:
dont_eat ()
Code:
dont_use ()
Code:
dont_drink ()
These comands would be placed at the top of a script so that it would remove the proccess of deleting or commenting out lines of code that call for eating, drinking, or the use of items you think are a waste of meat compared to what they help bring (ie. snowcones, cupcakes, etc...)

I'm not sure how easy it would be to implement this but it would deffinately be a HUGE help to most people.

--GT
 
I like the idea of this feature.  A simple function call that disables all eating, drinking, etc. features or even pass it an item that will ignore those item calls.

If you need a suggestion of how to handle this for now, simply put a line like this

Code:
bool eat = true;
bool drink = true;

and then keep your eating / drinking code seperated into functions.  At the beginning of those functions you just put

Code:
if ( eat == false ){   //Don't eat if eating is disabled
   return;
}

and the same for drinking.  I know this seems like extra work, but it's probably the best approach for now unless something comes of this post (which I'm pulling for)  ;D
 

Nightmist

Member
As a extension to what senseihitokiri said, you can also just "override" the use, eat and drink functions by making your own and then sticking a if check in there (and then use the CLI version of the command to actually execute it), probably the lazy mans method but meh.... (Personally my scripts have use, eat and drink all over the place so thats really the only method that would work for me without going though all the code and spending hours on it)
 
[quote author=holatuwol link=topic=463.msg2280#msg2280 date=1159240466]
Can someone explain to me why this would be useful?
[/quote]

Pretty much with all the dabate between the meat loss/gain of buying items it would allow for an easy way to skip the commands of using them. It could even just say if you don't have it, don't buy it...
 

BDrag0n

Member
I'm interested too - since it's easy enough to script in drunk checks, and handle failed eating, I can see limited use.

The only thing I can think of is easy modification of scripts written by other people - so if I wrote a script to eat spectral pickles, drink ESBM and meatfarm with snowcones, which for some reason happened to be a very good farming script, then someone could set all the don't options at the top to avoid the eat/drink/use features.

I can't see why (in that case) you wouldn't either
a) delete the offending sections of script or
b) copy relevant sections to your own script (with all credit where credit's due, of course).

Oops, thought of another - testing scripts. This would allow you to easily switch off functions in a script when testing other sections - but since commenting works, I don't think that's worth the effort of adding the commands.
 

holatuwol

Developer
Ah, debugging.  More debugging tools are a good thing.  Score one for BDrag0n, I'm convinced enough to add this feature.

Therefore, in the next release, any function can be disabled by calling a new library function (which you cannot disable, no matter how many times you ... try) called "disable" which accepts a string corresponding to the function name.  Note that any disabled function will result in a disabled CLI command as well, due to how the two are now connected.

Since it's for debugging, you'll also get friendly debug messages indicating when the function and/or command was disabled and what it was calling.  You will also be able to re-enable a function using the "enable" function which accepts a string corresponding to the function name.  In either function, you may use the word "all" to indicate you'd like to disable all functions or re-enable all functions.
 
Thanks holatuwol! Could you please post a code example of how you would use this? Also, would you also be able to enable/dissable purchases? Thanks again! And sorry for the brief description... I was in a hurry last night!
 

Nightmist

Member
Just as a random question.
By sticking this:
Code:
boolean use( int Qty, item TheItem)
{
 print( "Use disabled, attempted to use "+Qty+" of "+TheItem);
 return( false);
}
Would be just as effective as disabling "use" but also wont result in knocking out the CLI function? (Of course sticking a IF check in there to check for custom playersettings which would be the "enabled//disabled" check if your planning on turning it on again... assuming you want to keep the CLI command alive, which defeats the whole purpose of disabling the command in the first place I guess)
 
Top