Yet another Peak farming Script

Ok... So I got bored and decided to write a peak farming script based off of another script i edited. Since i'm such a N00B at this i wrote it in a format where you will most definately get an error when you run out of turns. Here is what the script does.

V 1.0.0
-looks to see if you have effects red tounge and Your Cupcake Senses Are Tingling
-If you don't it will use a red snowcone and pink-frosted cupcake
-run 20 turns at the peak
-repeat proccess

Once again, since i'm a total n00b i copy and pasted the scipt so that it would do this until you have gone 200turns. So you are bound to get errors. I haven't been able to test this but i'm almost possetive it works.... PLease post any comments or suggestions.

[EDIT]
V 1.0.1
-Now looks for a few more different effects. (you can see by reading the script.)

-GhettoTrucker
 

Attachments

  • GT_PeakFarm.ash
    855 bytes · Views: 221

macman104

Member
Ahh, we'll make a scripter out of you yet :).
Couple things I noticed. You can eliminate the need to duplicate your script over and over by wrapping it in a while loop. The loop would be:
Code:
while(my_adventures() > 0)
{
  your stuff here
}
This will run your loop as many times as needed to complete all your turns, whether it's 4 times or 400 times.
This code:
Code:
clie_execute("adventure [20] <icy peak>");
Is a little incorrect.
The command is: cli_execute, not clie_execute. Just a little typo there.
Then, for the CLI command to adventure, you don't need the [] around the turn count and the <> around the location name. So the resulting command looks like this
Code:
cli_execute("adventure 20 icy peak");
Of course, this can all be replaced by ASH's own adventure command:
Code:
adventure(20, $location[icy peak]);
Also, if you are going to have a void main() in your script, then you want to put your whole code into the main() function, unless you are using other support functions besides main(). Putting all of this together, your newest code should look something like...
Code:
void main()
{
  while(my_adventures() > 0)
  {
   if(have_effect($effect[Your Cupcake Senses Are Tingling]) < 1)
   {
    use(1, $item[pink-frosted astral cupcake]);
   }
   if(have_effect($effect[red Tongue]) < 1)
   {
    use(1, $item[red snowcone]);
   }
   adventure(20, $location[icy peak]);
  }
}
Now, we can get really fancy, and say, well if I have less than 20 adventures during the loop, I don't want it to run 20, I want it to run the rest of my adventures. We can check this and run the correct code by doing the following.
Code:
if(my_adventures() >= 20)
{
  adventure(20, $location[icy peak]);
}
else
{
  adventure(my_adventures(), $location[icy peak]);
}
This code would replace your one line for the adventure command.

So...after all of this (which hopefully I haven't moved too quickly for you to follow), we end up with:
Code:
void main()
{
  while(my_adventures() > 0)
  {
   if(have_effect($effect[Your Cupcake Senses Are Tingling]) < 1)
   {
    use(1, $item[pink-frosted astral cupcake]);
   }
   if(have_effect($effect[red Tongue]) < 1)
   {
    use(1, $item[red snowcone]);
   }
   if(my_adventures() >= 20)
   {
     adventure(20, $location[icy peak]);
   }
   else
   {
     adventure(my_adventures(), $location[icy peak]);
   }
  }
}
Finally, that's done. You started off with a great base script to improve on, and this is the kind of effort that we like to see for someone to invest in before we write things out for you. Thanks for putting in the effort to put this together, and offering it to the community.
 

Nightmist

Member
If you also want to avoid mafia erroring out due to lack of item you can also use something among the lines of
Code:
if(have_effect($effect[red Tongue]) < 1 && item_amount( $item[red snowcone]) > 0)
{
 use(1, $item[red snowcone]);
}
 
ok, thanks for the help mac and nightmist. I'm starting to get the hang of it. But i think it'll be a while before i'm a master 'coder' like yall....LOL I'm gonna replace my code with that of mac's as it is ALOT cleaner.

[EDIT]
Ok, so for a clan event we are sending everything we want to a specific player in the clan. What i want to add into my personal script is a 'send everything i earned in this session to ___' command. is thier such a command or would i have to manually say cli_execute("send * yeti fur|penguin skin to _____) als o can you use the "|" character to make one long line to send multiple items?
 

macman104

Member
For the send command, you can do a
Code:
send * item, * item, * item, * item to playername
You can add as many * items as you want. Also, using the "*" has the added benefit of ignorning if you have 0 items as well. Just have whatever items you want to send in the list, doesn't matter if you have them or not, mafia will attempt to add them to the list if you have them, but won't error out if you don't. Also, if you mafia needs to break the kmail into multiple messages, it'll do that as well. Please note that in order to prevent spamming, mafia does not let you send the same message twice, so if your script errors out while running, you'll have to shut down mafia and start again. Oh, btw, it is a CLI command, so you'll need to use the cli_execute format.
 
add a note to macman104's advice. If you exceed 11 items being sent in the main interface, and meat also, the meat does not seem to get sent. If 11 items or less, the meat is sent normally. I do not know if this is the case with the cli send command or not, but logically it seems it would.
 

macman104

Member
It's looking good Ghetto. Couple typos:
Code:
if(have_effect($effect[red Tongue]) < 1)
   {
    use(1, $item[red snowcone]);
   if(have_effect($effect[Heavy Petting]) < 1)
   {
There should be a close bracket after the use red snowcone line. So it should be:
Code:
if(have_effect($effect[red Tongue]) < 1)
   {
    use(1, $item[red snowcone]);
   }
   if(have_effect($effect[Heavy Petting]) < 1)
   {
You have an extra close bracket a little farther down after your wasabi sinus check. Get rid of that one. The other thing to note is that, you know that using the red snowcone and black oyster eggs give you a -net profit right? You are better off selling those in the mall. The other ones are cheap enough (I'm not sure about the cupcake but the knob stuff is, I'm pretty sure) that you'll make money off of them. Just something to consider, other than that, it looks good.
 
well i wrote the snowcone in because i usually have a bunch on hand because i buy them in BULK in /trade so i get a good price on them. Yes, if you don't have any on hand when the script is running it will biy them in the mall (for a loss) so you can comment it out if you want. But i'm gonna leave it in.
 
Top