The Neo-Cow Farming Script

Winterbay

Active member
Sounds like something is converting a string into something and that string contains some strange character that Mafia doesn't like. But I am not at all certain about that, knowing what code caused it (at least partly) would make it easier.
 

xKiv

Active member
That character (paragraph mark) is called "pilcrow" and it instructs mafia to look up the item by exact item id.
This means that the error is telling you you are trying to look up item with ID -1.
 

Veracity

Developer
Staff member
You are invoking an ASH function that takes an item and calls in turn a CLI command with that character and the item ID - which is -1, in this case. That's how ASH prevents the CLI from try to (or having to) parse the item name again.

I assume you made an item with a bogus name, which ends up with item id -1. This example shows how that might happen:

> ash to_int( to_item( "bogus" ) )

Returned: -1
 

Banana Lord

Member
Hmm. A cli command? Below is the function which results in the error. The strange thing is that when I import ncf.ash into a test script and execute file_empty("ncf_effects_to_remove.txt"); it works fine, but when it's called during execution of the whole script it throws up that error.


PHP:
boolean file_empty(string file) // Only works for maps like this -> string [string] map_name
	{
	print("file_empty", "blue");
	file_to_map(file, test_map);
	int entries = 0;
        print(file); #Used for testing
	foreach entry in test_map
		{
		entries += 1;
		}
	clear(test_map);
	
	if(entries > 0)
		return False;
	else
		return True;
	}
On importing ncf.ash into a test script and executing file_empty("ncf_effects_to_remove.txt"); I get:
Code:
file_empty
ncf_effects_to_remove.txt
true

On running ncf.ash itself I get this (ignoring all earlier output).
Code:
file_empty
ncf_effects_to_remove.txt
[¶-1] has no matches.
 

Veracity

Developer
Staff member
Below is the function which results in the error. The strange thing is that when I import ncf.ash into a test script and execute file_empty("ncf_effects_to_remove.txt"); it works fine, but when it's called during execution of the whole script it throws up that error.
You did not demonstrate that the function you included "resulted in the error". In fact, I think that what you just said - you import the file and call the function with no problem - demonstrates conclusively that it was NOT that function.

On importing ncf.ash into a test script and executing file_empty("ncf_effects_to_remove.txt"); I get:
Code:
file_empty
ncf_effects_to_remove.txt
true
Uh huh. Your function is fine.

On running ncf.ash itself I get this (ignoring all earlier output).
Code:
file_empty
ncf_effects_to_remove.txt
[¶-1] has no matches.
Uh huh. So look at the code in ncf.ash that is executed AFTER you call "file_empty("ncf_effects_to_remove.txt");" Simply calling that function does not print "true" or "false".

(By the way - why not simply "return ( entries == 0 );" ? Or, for that matter, rather than iterating over the entries in the map, "return count( test_map ) == 0;" )
 

Banana Lord

Member
... demonstrates conclusively that it was NOT that function.
OK, sorry, bad explanation. I meant that the error occurs while that function is running because (with reference to the code below) it prints "hi" but not "there".

PHP:
boolean file_empty(string file) // Only works for maps like this -> string [string] map_name 
    { 
    print("file_empty", "blue"); 
    file_to_map(file, test_map); 
    int entries = 0; 
        print("hi");
    foreach entry in test_map 
        { 
        print("there");
        entries += 1; 
        } 
    clear(test_map); 
     
    if(entries > 0) 
        return False; 
    else 
        return True; 
    }

By the way...
Because I had no idea you could do that. Always happy to learn though :)
 

Veracity

Developer
Staff member
OK, sorry, bad explanation. I meant that the error occurs while that function is running because (with reference to the code below) it prints "hi" but not "there".
That is consistent with the file being empty. It prints "there" inside the loop that counts entries.
When you run it standalone, it returns "true" - there are no entries.
 

Banana Lord

Member
Here's where I'm up to. Version 2.0 isn't so much an update as a total rewrite (although I've borrowed good ideas and taken general direction from the original script). Puttyfarming is completely untested and I haven't got around to sorting out bountyhunting so that'll have to wait for my upcoming break. It should however make a reasonable attempt at farming. The relay script (which seems to work in some browsers but not others) will help you configure the script's settings, but you'll have to edit NCF_Buffbot_Buffs.txt (buffs you want to get from buffbots) and NCF_Effects_to_Remove.txt (effects you want to remove before and during farming) yourself.

For any kind, caring and wonderful people who want to test this for me
Please post any bugs, feature requests or other suggestions so that I can keep improving the script. It's ticking along nicely at the moment, but I'm bound to miss something that another person will see.

You should have the following scripts installed and set up before running NCF.ash:
Scripts Required
zlib
EatDrink
OCD Inventory Control

Scripts Recommended
CounterChecker -> If you want to get semi rares
Universal Recovery -> For optimal HP/MP recovery
Pyromania -> If you want to configure you MP burning settings

General Information
From now on you will only need to worry about two data files: NCF_Buffbot_Buffs.txt (containing a list of all the effects you want to get from a buffbot before farming) and "NCF_Effects_to_Remove.txt" (containing a list of all the effects you want to get rid of before and during farming). The format for these files is: effect_name<tab> eg:
Code:
fat leon's phat loot lyric
You do not need to create or download these files yourself, the script will do that automatically the first time you run it. With the exception of buffbot buffs, all effects (and librarm summoning) are now managed directly by the user with moods and pyromania.ash.

To set the script up run Neo-Cow_Farm from the relay browser and configure the script to your liking. NCF will intelligently modify its default settings for some options (for example, if you have a hobo monkey it'll choose that over a leprechaun). Thanks to Bale, it now also has access to some default OCD data, meaning that if you've never run OCD before you don't have to work your way through your entire inventory to configure actions for items found during castle farming. If you want to use NCF Combat.ash then the first 2 lines of your CCS must be:
Code:
[default]
[FONT=Courier New]consult ncf_combat.ash[/FONT]
Warning: This script has not been thoroughly tested and while it almost certainly won't go nuts and wreak havoc, I highly recommend watching the GCLI like a hawk if you choose to run it .

EDIT: Files removed. Barring unexpected mishap the next release is imminent.
 
Last edited:

Banana Lord

Member
Somehow I've managed to get a relay script up and running for NCF (I now know super-basic html :D). It provides an easy way to change script settings and gives a readout of historical farming data (new feature). I've run into three stumbling blocks though:

  1. Because of the way maps work the options are presented in alphabetical. I would prefer a custom order, potentially with subheadings for different sections.
  2. The settings column is not behaving in Chrome (not values entered in cells) or Firefox (no cells at all), but works perfectly in Safari.
  3. I can't see any way of editing the two data files (NCF_Buffbot_Buffs.txt and NCF_Effects_to_Remove.txt) from the relay script as there seems to be no aggregate write_textarea(...) function.
I've attached relay_Neo-Cow_Farm.ash to the previous post along with updated (and much more stable) versions of the other two scripts. As always any and all help is greatly appreciated.

EDIT: Problems 1 and 2 solved! Still got nothing on #3.
 
Last edited:
Top