Broken pulverize script.. Help me with a few commands?

hippymon

Member
I am trying to fix it myself, but I am having problems with the pulverize command..

Code:
cli_execute("call script PulvTest.ash");

pulverize(item_amount($item[ lupine sword ]), $item[ lupine sword ]);
pulverize(item_amount($item[ serpentine sword ]), $item[ serpentine sword ]);
pulverize(item_amount($item[ snarling wolf shield ]), $item[ snarling wolf shield ]);
pulverize(item_amount($item[ snake shield ]), $item[ snake shield ]);
pulverize(item_amount($item[ antique greaves ]), $item[ antique greaves ]);
pulverize(item_amount($item[ antique helmet ]), $item[ antique helmet ]);
pulverize(item_amount($item[ antique shield ]), $item[ antique shield ]);
pulverize(item_amount($item[ antique spear ]), $item[ antique spear ]);
pulverize(item_amount($item[ clockwork staff ]), $item[ clockwork staff ]);
pulverize(item_amount($item[ clockwork sword ]), $item[ clockwork sword ]);
pulverize(item_amount($item[ astronaut pants ]), $item[ astronaut pants ]);
pulverize(item_amount($item[ denim axe ]), $item[ denim axe ]);
pulverize(item_amount($item[ leather chaps ]), $item[ leather chaps ]);
pulverize(item_amount($item[ MagiMechTech NanoMechaMech ]), $item[ MagiMechTech NanoMechaMech ]);
pulverize(item_amount($item[ mesh cap ]), $item[ mesh cap ]);
pulverize(item_amount($item[ star buckler ]), $item[ star buckler ]);
pulverize(item_amount($item[ star crossbow ]), $item[ star crossbow ]);
pulverize(item_amount($item[ star hat ]), $item[ star hat ]);
pulverize(item_amount($item[ star pants ]), $item[ star pants ]);
pulverize(item_amount($item[ star shirt ]), $item[ star shirt ]);
pulverize(item_amount($item[ star staff ]), $item[ star staff ]);
pulverize(item_amount($item[ star sword ]), $item[ star sword ]);
pulverize(item_amount($item[ toy jet pack ]), $item[ toy jet pack ]);
pulverize(item_amount($item[ toy space helmet ]), $item[ toy space helmet ]);
pulverize(item_amount($item[ batblade ]), $item[ batblade ]);
pulverize(item_amount($item[ drywall axe ]), $item[ drywall axe ]);
pulverize(item_amount($item[ giant discarded bottlecap ]), $item[ giant discarded bottlecap ]);
pulverize(item_amount($item[ giant discarded plastic fork ]), $item[ giant discarded plastic fork ]);
pulverize(item_amount($item[ giant discarded torn-up glove ]), $item[ giant discarded torn-up glove ]);
pulverize(item_amount($item[ giant needle ]), $item[ giant needle ]);
pulverize(item_amount($item[ glowing red eye ]), $item[ glowing red eye ]);
pulverize(item_amount($item[ Mohawk wig ]), $item[ Mohawk wig ]);
pulverize(item_amount($item[ ridiculously huge sword ]), $item[ ridiculously huge sword ]);
pulverize(item_amount($item[ star spatula ]), $item[ star spatula ]);
pulverize(item_amount($item[ wolf mask ]), $item[ wolf mask ]);
pulverize(item_amount($item[ yakskin kilt ]), $item[ yakskin kilt ]);
pulverize(item_amount($item[ yakskin pants ]), $item[ yakskin pants ]);
pulverize(item_amount($item[ yakskin skirt ]), $item[ yakskin skirt ]);
pulverize(item_amount($item[ broken sword ]), $item[ broken sword ]);
pulverize(item_amount($item[ buffalo blade ]), $item[ buffalo blade ]);
pulverize(item_amount($item[ chrome crossbow ]), $item[ chrome crossbow ]);
pulverize(item_amount($item[ chrome helmet turtle ]), $item[ chrome helmet turtle ]);
pulverize(item_amount($item[ chrome staff ]), $item[ chrome staff ]);
pulverize(item_amount($item[ chrome sword ]), $item[ chrome sword ]);
pulverize(item_amount($item[ giant cheesestick ]), $item[ giant cheesestick ]);
pulverize(item_amount($item[ hairy staff ]), $item[ hairy staff ]);
pulverize(item_amount($item[ heavy metal thunderrr guitarrr ]), $item[ heavy metal thunderrr guitarrr ]);
pulverize(item_amount($item[ hippopotamus kilt ]), $item[ hippopotamus kilt ]);
pulverize(item_amount($item[ hippopotamus pants ]), $item[ hippopotamus pants ]);
pulverize(item_amount($item[ hippopotamus skirt ]), $item[ hippopotamus skirt ]);
pulverize(item_amount($item[ penguinskin mini-kilt ]), $item[ penguinskin mini-kilt ]);
pulverize(item_amount($item[ penguinskin mini-skirt ]), $item[ penguinskin mini-skirt ]);
pulverize(item_amount($item[ pitchfork ]), $item[ pitchfork ]);
pulverize(item_amount($item[ ram-battering staff ]), $item[ ram-battering staff ]);
pulverize(item_amount($item[ shuddersword ]), $item[ shuddersword ]);
pulverize(item_amount($item[ silver shrimp fork ]), $item[ silver shrimp fork ]);
pulverize(item_amount($item[ smoldering staff ]), $item[ smoldering staff ]);
pulverize(item_amount($item[ Spirit Precipice ]), $item[ Spirit Precipice ]);
pulverize(item_amount($item[ star boomerang ]), $item[ star boomerang ]);
pulverize(item_amount($item[ star stiletto ]), $item[ star stiletto ]);
pulverize(item_amount($item[ titanium assault umbrella ]), $item[ titanium assault umbrella ]);
pulverize(item_amount($item[ snowboarder pants ]), $item[ snowboarder pants ]);
pulverize(item_amount($item[ oversized pizza cutter ]), $item[ oversized pizza cutter ]);
pulverize(item_amount($item[ eXtreme scarf ]), $item[ eXtreme scarf ]);
pulverize(item_amount($item[ flaming crutch ]), $item[ flaming crutch ]);

cli_execute("create * twinkly wad");

cli_execute
{
mallsell * twinkly wad @ 0, * hot wad @ 0, mallsell * cold wad @ 0, * stench wad @ 0, * spooky wad @ 0, * sleaze wad @ 0, * twinkly nuggets @ 0, * stench nuggets @ 0, * spooky nuggets @ 0, * sleaze nuggets @ 0, * hot nuggets @ 0, * cold nuggets @ 0, * cold powder @ 0, * hot powder @ 0, * sleaze powder @ 0, * spooky powder @ 0, * stench powder @ 0, * twinkly powder @ 0, * useless powder @ 0 
}

^^ That script is the main problem at the moment, it calls upon the script below and I am not sure how to get the "pulverize(item_amount..." to work, it continues to say that "Undefined reference 'pulverize' (PulvMallDump.ash, line 3)" I have tried "crush" "pulv" and "pulverize" none seem to work.

Code:
record pulvdata_record
  {
  int samples;

  int twinkly_wads;
  int cold_wads;
  int hot_wads;
  int sleaze_wads;
  int spooky_wads;
  int stench_wads;

  int twinkly_nuggets;
  int cold_nuggets;
  int hot_nuggets;
  int sleaze_nuggets;
  int spooky_nuggets;
  int stench_nuggets;

  int twinkly_powder;
  int cold_powder;
  int hot_powder;
  int sleaze_powder;
  int spooky_powder;
  int stench_powder;
  
  int ultimate_wad;
  int useless_powder;
  };
  //note ultimate wads and useless powder were added after the map file was built, but the map file loads fine.

pulvdata_record[item] pulverize_data;


boolean pulv(int quant, item tosmash)
{
  if(quant == 0){return false;}
  string results = visit_url("smith.php?action=pulverize&pwd=&quantity=" + quant + "&smashitem=" + item_to_int(tosmash));
  //int [item] extract_items( string text )
  //don't mess with the data if we fail to smash the item.
  if (!contains_text(results, "You smash")){return false;}
  int [item] got_these = extract_items( results );

  pulverize_data[tosmash].samples = pulverize_data[tosmash].samples + quant;
  pulverize_data[tosmash].twinkly_wads = pulverize_data[tosmash].twinkly_wads + got_these[$item[twinkly wad]];
  pulverize_data[tosmash].cold_wads = pulverize_data[tosmash].cold_wads + got_these[$item[cold wad]];
  pulverize_data[tosmash].hot_wads = pulverize_data[tosmash].hot_wads + got_these[$item[hot wad]];
  pulverize_data[tosmash].sleaze_wads = pulverize_data[tosmash].sleaze_wads + got_these[$item[sleaze wad]];
  pulverize_data[tosmash].spooky_wads = pulverize_data[tosmash].spooky_wads + got_these[$item[spooky wad]];
  pulverize_data[tosmash].stench_wads = pulverize_data[tosmash].stench_wads + got_these[$item[stench wad]];
  pulverize_data[tosmash].twinkly_nuggets = pulverize_data[tosmash].twinkly_nuggets + got_these[$item[twinkly nuggets]];
  pulverize_data[tosmash].cold_nuggets = pulverize_data[tosmash].cold_nuggets + got_these[$item[cold nuggets]];
  pulverize_data[tosmash].hot_nuggets = pulverize_data[tosmash].hot_nuggets + got_these[$item[hot nuggets]];
  pulverize_data[tosmash].sleaze_nuggets = pulverize_data[tosmash].sleaze_nuggets + got_these[$item[sleaze nuggets]];
  pulverize_data[tosmash].spooky_nuggets = pulverize_data[tosmash].spooky_nuggets + got_these[$item[spooky nuggets]];
  pulverize_data[tosmash].stench_nuggets = pulverize_data[tosmash].stench_nuggets + got_these[$item[stench nuggets]];
  pulverize_data[tosmash].twinkly_powder = pulverize_data[tosmash].twinkly_powder + got_these[$item[twinkly powder]];
  pulverize_data[tosmash].cold_powder = pulverize_data[tosmash].cold_powder + got_these[$item[cold powder]];
  pulverize_data[tosmash].hot_powder = pulverize_data[tosmash].hot_powder + got_these[$item[hot powder]];
  pulverize_data[tosmash].sleaze_powder = pulverize_data[tosmash].sleaze_powder + got_these[$item[sleaze powder]];
  pulverize_data[tosmash].spooky_powder = pulverize_data[tosmash].spooky_powder + got_these[$item[spooky powder]];
  pulverize_data[tosmash].stench_powder = pulverize_data[tosmash].stench_powder + got_these[$item[stench powder]];
  pulverize_data[tosmash].ultimate_wad = pulverize_data[tosmash].ultimate_wad + got_these[$item[ultimate wad]];
  pulverize_data[tosmash].useless_powder = pulverize_data[tosmash].useless_powder + got_these[$item[useless powder]];
  return true;
}

void crush(int quant, item tosmash)
{
  //yeah yeah save the dang file every time data is added...this is the namespace function.
  //so it needs to save every time.
  //no need to save the file if we did not succeed though
  if(pulv(quant, tosmash))
  {
  map_to_file( pulverize_data, "pulv.txt" );
  }
}

^^ I have yet to be able to test this script due to the first script not working, so I know not if it works. But, for all I know this script is the problem... Any help anyone?
 

hippymon

Member
[quote author=holatuwol link=topic=1019.msg5135#msg5135 date=1184466383]
There is no pulverize command.
[/quote]

So, there is no way to pulverize items via script?

[quote author=macman104 link=topic=1019.msg5138#msg5138 date=1184470856]
Are you typing that into the gCLI (pulverize....)? Or are you just running the script?
[/quote]

I am running the script.
 

macman104

Member
I'm not sure you understand how this script works. The commands from the thread that the script your using, is
Ash users must remember to save the data (or finalize the map) use the functions:
boolean pulv(int quant, item tosmash) does the pulverising, and adding data to the map.
void finalize_pulv_data() saves the data when done.
So...the command is "pulv" not pulverize. Also, this script is really used as a data mining tool. Just so you're aware of that.

So..change all of your pulverize commands to pulv. Then when the script is done, you have to call the finalize_pulv_data() function. Also, you don't actually call PulvTest.ash, you import it.
 

hippymon

Member
Oh, ok.. Sorry to who ever the original creator of this script is. I completely screwed everything up in my script folder.. So, as of now I am just trying to figure out what is what, thought this script was it's own thing.. Well, that clears it up! Thank you!
 
No need to apologize. I am the writer. Sadly I never could get everything about it working exactly right.

Anyway, fixing the script to pulverize stuff is simple. That first script you listed above...replace the line "cli_execute("call script PulvTest.ash");" with the following code.

Code:
boolean pulverize(int quant, item tosmash)
{
	if(quant == 0){return false;}
	string results = visit_url("smith.php?action=pulverize&pwd=&quantity=" + quant + "&smashitem=" + item_to_int(tosmash));
	if (contains_text(results, "You smash"))
		{return true;}
        return false;
}
 
Top