script request

Status
Not open for further replies.

iain7

Member
i am a level 16 seal clubber - my muscle is 257 and my moxie is 323. To my knowledge i can hit everything and not get hit by anything. So, here is my situation. I want to farm, but my parents only allow me 30 minutes a day on the computer!
I need a script which will farm for me, spending half my adventures in the Castle with my leprechaun, and half of my adventures in the Airship with my fairy.

At the beginning,it puts on an outfit named Farming.
It will then drink 3 Mon Tikis and 2 fine wines. If none can be found, it buys from mall.
It then uses a milk of magnesium, and eats 3 knob chows. Again, it buys from mall if it cant be found.
Then it uses 15 twinkly wads, again buys from mall if there aren't any.
It equips my leprechaun, named Meaty, and spends half of its adventures in then Castle, then equips my baby gravy fairy, named itemy, and spends the other half.
It then uses the chests and the warm subject gift certificates, pulverises anything it needs to, turning them to wads, and autosells the rest of the drops.
It then puts on an outfit named rollover.

As you can see, there isnt that much to do. I am going to get bulk buffs so the buffbots dont get annoyed, and i take care of the final drops myself.
I read the requests page, and found the price for a script is around 4.5mill!!!! =O
I dont have the cash ATM, i can give you all the cash i make from one month of farming with the script! Ill make very very roughly around 150k a day, so 31 x 150 = just over 4.5mill. Lol.

Because you will have to wait for payment, i can understand many of you will not want to do this. so instead, heres the preposition.
You script most of the difficult bits, sorta half teaching me how to do the easy bits along the way, and explaining what you are scripting. That way, by the end, you wont have done as much work, and ill have a basic understanding of scripting! =O

post a reply here if interested, we can work somthing out.
 

macman104

Member
I will tell you that you will have a way better response chances if you show that you've actually put some effort into the scripting. If you look around in the turn-burning area or just do a search for farming, you will see many scripts that have been written, and you'll also see many people like yourself asking for the same thing. People aren't always so keen on the "I am looking for this script, if someone could write it that would be awesome". However if you post with a "here's what I've written for this script so far, but I'm kinda of stuck on such and such part", you'll get a much, much better response. Seriously, try a little searching, and see what you come up with. We'll be glad to help, if you help us and meet us part way...
 
i am working on the script right now!
Edit: Ok, I finished the script in .ash
It is my first attempt in .ash so please no insults. Also, I haven't been able to test
it because all of characters are falling down drunk. So don't be mad if it doesn't work.
Thanks.
 

Attachments

  • meatfarming.ash
    1.8 KB · Views: 162

macman104

Member
The beginning of it looks pretty solid, the latter part of it...might need a little touching up. Most noticeably, you call a function checkEffects(), but I don't see that function anywhere. That will throw an error. Also, for every open curly brace, you need to have a corresponding closing one, otherwise, you'll get an error there as well. I've attached a modified version of it, I'll explain what I changed and why...

You'll see a big huge list of items at the top, this is what is called a map, and it is indexed by the item name. As the comment says, by setting the different items to a different number, you can change how they are disposed of after the farming. I'll discuss more later about this. I'll also made a map for wad types for later use as well.
Code:
familiar meatFam = $familiar[leprechaun];
familiar itemFam = $familiar[baby gravy fairy];
I added this code, because in case they should ever want to change the familiar, it'll be easy to do so with these set variables, which are used later in the program
Code:
int castleAdventures = my_adventures() / 2;
int pfaAdventures = my_adventures() - castleAdventures;
Throughout your code, you were calculating your current adventures and everything. However, once the person is done eating and such, they're total adventures arent' going to change, so I opted for calculating these values ahead of time and saving the number of adventures to use.
Code:
adventure(castleAdventures, $location[castle in the clouds in the sky]);
Instead of looping through with a while loop like you did, I used the calculated number I had and simply executed a bulk request to burn all the turns I wanted to. This is a much simpler way to accomplish the same thing you were trying to do.

Then you can see I switch familiars, and burn the remaining adventures at the airship.

This next part is the biggest change. I've just started really utilizing maps, and I've really come to love them, as they simplify your code by a huge amount. Angered, if you can eventually understand them, I think it'll help you out alot. Anyway
Code:
foreach item in disposeChoice
{
	if(disposeChoice[item] == 1)
	{
		use(item.item_amount(), item);
	}
	else if(disposeChoice[item] == 2)
	{
		autosell(item.item_amount(), item);
	}
	else if(disposeChoice[item] == 3)
	{
		cli_execute("pulverize * " + item);
	}
}
This block of logic, basically says, take my map disposeChoice and for every item, see what number I assigned to it. Depending on what number is assigned, take the appropriate course of action.

The last block of code...
Code:
foreach wad in wadType
{
	cli_execute("create * " wad);
}
Is simply my way of simplifying creating any possible wads that we could.

Angered, it was a good attempt, there were just a few loose ends in your script that I had initially meant to tie up. Then, I started going at it, and...yea, just sorta turned into this. Like I said before, the biggest thing was the use of the while loop, the checkEffects() function that didn't exist, and you also grabbed the player's current meat but you didn't use it anywhere else later on.

So...yea, hopefully my explanations of things help make some sense, and explain a few different ways to approach the same issue.
 

Attachments

  • AlteredMeatFarm.ash
    4.2 KB · Views: 98
thanks.
i didn't really use the .ash guide so i was kinda looking off an ash script that i downloaded and sorta taught myself the way on.
 

iain7

Member
thanks so much guys! ill see if i can work out the basics of how CLI works with the scripts you've given me, (ie printing them off and reading them on way to school for an hour, with the help of a fellow computer fanatic, albeit one 2 years older than me =)

Once i have the basic idea, i will edit a few bits... maybe, and eventually, once i really understand what the CLI guide on sourceforge means, make my own. For someone who has never scripted before except for the most very basic tools in HTML, it seems like Greek to me!
oh yes, and about the paying thing and the making your own at the beginning thing -

1) making my own at the beginning -
I made this post for two reasons: to get a script and to learn how to script. Lol. I could not understand the guides others had written, and knowing how i myself learn, wanted to see some decent examples of what i actually want to do.

2) paying -
Being new to this forum and having one of my topics locked and the other deleted =P i dont know much about the community here yet, although im beginning to grasp the basic idea now. Reading the guidelines, i saw it said give them a mr. a per script, maybe 10 mr. as. With my previous experience, i just gave in and decided i may as well work for the people who gave up their time for me for a while, even though 4.5mill for a script does sound a bit off to me!
Now i understand that you guys take pride in your work, as i do with my own skills in other subjects ( i hate seeing somebody doing something wrong - i have to correct them! lol) i will sorta twist the rules a bit like everyone else does. But, i have to say, the people who helped look like theyve done quite a bit, so maybe a small reward is in order, like 10 candy hearts each or somthing. ;)
oh and maybe a slightly larger award for the people who actually spend a rather amazing amount of time - im quite impressed that the best scripters in this forum have started a script for me, a kind of newbie =P. The reason i am trying to learn to script is although iain7 isnt one of my character names, i am working towards making a buffbot. I'm learning to script so i can make a buffbot script which i can post here and you lot can comb it over and laugh at me because of the dodgy bits lol, and im farming because buffbots need ALOT of money :-[
 
[quote author=angeredtsuzuki link=topic=962.msg4805#msg4805 date=1181598350]
and, for payment. i dont really care, but it would be appreciated.
[/quote]
...lol... :D As much as we would all enjoy payments for scripts we work on, it doesn't always happen. Maybe you'll be one of the lucky few though!
 
yeah.
i hope so, one of my friends that gave me his old account logged on yesterday
and used all of my meat (1 million) at the MMG and lost it all
what a moron.
 

dangerpin

Member
If you can *only* lose one million and walk away forever consider it a win. I live with a person who has lost tens of millions and know at least two people who have lost over 100 million meat. This isn't "Know of" these are people I actually hang out with.
 

iain7

Member
its true. VGAAA buffbot, the one im working on, lost 30 mill =( ive lost 2 mill. never, ever again. lol.
 

iain7

Member
oo-er... lol. bet you were mad at him!

BTW i am getting to grips with the script now . When you say 1 is to use the item, 2 is to sell it etc, it is in slashes though, so how does the script know that 1 is to use etc?

Also, when you use the items, it doesnt say anything about buying from mall if there arnt any. So, would it work with something like
Code:
int $item mon tiki == 3
else shop amount $item mon tiki minus 3

I'm still very very bad at it, and theres probably a few invalid words in there, but you get my drift? it wont continue the script till it has 3 mon tikis, 1 milk of magnesium etc, THEN it will consume them. lol
ooh i just remembered. i wanted a give to collectors option for the chaos butterflies or a put in mall option for the wads, but would it be too much work? can you point me to any scripts with that sort of thing so i can get the idea? thanks. ;D
 

macman104

Member
[quote author=iain7 link=topic=962.msg4831#msg4831 date=1181715458]
oo-er... lol. bet you were mad at him!

BTW i am getting to grips with the script now . When you say 1 is to use the item, 2 is to sell it etc, it is in slashes though, so how does the script know that 1 is to use etc?[/quote]Oh, the notation of "//" signifies that the text following is a comment. The script ignores that, and that is simply there to help notate a script and help explain anything in it. The script knows that 1 is to use, etc, because further down that is how I coded it.
Also, when you use the items, it doesnt say anything about buying from mall if there arnt any. So, would it work with something like
Code:
int $item mon tiki == 3
else shop amount $item mon tiki minus 3
The use command *should* buy the items from the mall if you don't already have them, however, hola or someone else may have to jump in here to clarify if that is true or not.

The script I provided is probably way advanced for you at the moment. Part of the reason I provided it was to show angeredtsuzuki how I personally thought it could be cleaned up some, and made easier to maintain.

For you iain, if you want to run the script, I believe it should run (as long as there aren't any errors in it). If you want to change what the script does with the various items, just change the numbers I assigned at the top of the script for the items. For example, let's say you wanted to sell your ridiculously huge swords, right now the line reads
Code:
disposeChoice[$item[ridiculously huge sword]] = 3;
A number of 3 indicates the item will be pulverized. If you want to autosell the item instead, you simply change the 3 to a 2. It would now read
Code:
disposeChoice[$item[ridiculously huge sword]] = 2;
If you want support for other options, let me know. Right now, with this script you can only use the item, autosell it, or pulverize it. If you want to do something different with the item not supported by the script (for example, put the sword in the mall), set the number equal to 0 and let me know. I'll add support for various actions later. Adding items to the mall is easy...the collector stuff...probably won't happen, at least from me. Let me know if what I said is going way over your head or not, and I'll try to explain better...
 

iain7

Member
i understand perfectly - once ive broken the backbone of scripting, it doesnt seem impossible anymore!!!
Izchak_castlefarm.ash uses the collectors function, explaining how to refer to an outside script which contains a list of people to sell to, the price they sell at and what item.
would i need to pm him if i "borrowed" that part (if it works, that is) lol.
anyway, with NS 13 coming any day now, im guessing im going to get the chance to add things to this script anyway! =)
 

macman104

Member
[quote author=iain7 link=topic=962.msg4838#msg4838 date=1181765165]
i understand perfectly - once ive broken the backbone of scripting, it doesnt seem impossible anymore!!!
Izchak_castlefarm.ash uses the collectors function, explaining how to refer to an outside script which contains a list of people to sell to, the price they sell at and what item.
would i need to pm him if i "borrowed" that part (if it works, that is) lol.
anyway, with NS 13 coming any day now, im guessing im going to get the chance to add things to this script anyway! =)
[/quote]Glad to hear you understand the script better, and yes, with NS-13 coming, new items will be on their way, and I'm sure you'll have the opportunity to modify things. For the collectors part, I would probably go about it this way
Code:
/*
 *The following code is to send items to collectors.  It was developed
 *by izhack.  The script that this code comes from is located here:
 *[url]http://kolmafia.us/index.php/topic,801.0.html[/url]
 */

Insert code and the like here

EDIT: Also, if there is support for other actions with the items you would like, let me know. Or you can try to do it yourself, and we/I'll be happy to help you fix it up if you can't figure it out
Second Post (Combined into first, so as to avoid the wrath of he who we call daychilde ;D) So in a wild fit of insomnia (not really, I just stay up late), I reworked the script a little bit, and put everything into functions to make it easier to rework the script in the future. It also allowed me to test the new way I executed the cli string without commenting tons of code by not calling those functions. Added pretty block comments also. Oh, and I made it so that it doesn't bother adding a item to the cli_execute strings if you don't have any (item.item_amount() > 0). So...yay night owls!
ZOMG Third Post! Edit yet again, this time I added logic to the script so that it drinks the items that are best for your stat. Whether you be muscle, myst or moxie. It uses the advanced cocktail items and chow mein, but if that's isn't what you want, if you look in the script, you shouldn't find it too hard to alter.
 

Attachments

  • AlteredMeatFarm.ash
    5.2 KB · Views: 55

izchak

Member
About my collectors.txt file, you may certainly use it!
I have made things easier for you, and wrote a small script which you should be able to import, to add the collectors functionality to your script. Simply put
Code:
import <collectables.ash>;
at the top of your script, and you should then be able to use the 'boolean check_collectors(item checkMe)' function.
If someone collects the given item, and you have more than zero of it, it will return true.
Otherwise, it'll return false, so you can autosell it, or whatever.

NOTE: I hacked this out of my main script, and checked that the syntax is good (verify collectables.ash), but I have NOT actually tested it. I believe it should work, but I believe a lot of odd things!
If it doesnt work, or if someone can prove the earth isn't flat, pm me, so I can correct my beliefs.

[size=1pt](just kidding about the flat earth thing, srsly)[/size]
 

Attachments

  • collectables.ash
    2.7 KB · Views: 40
  • collectors.txt
    309 bytes · Views: 47

iain7

Member
thanks alot! lol so all i do is put import; at the very top of my script and have collectables.ash and the other thing in my scripts folder? it doesnt sound quite right! lol.
 

izchak

Member
Simply put "import <collectables.ash>;" at the top of the script, For some reason you have to do your importing right at the start of the script, before you do anything else.

As for the collectors.txt, I put mine in my kolmafia/data directory; because its data and not a script, but it works just as well in the scripts directory!

Also, just to clarify : importing this scriptlet into your script wont make any magic happen, but it'll let you build some magic, by calling the aforementioned function to see if someone collects a given item. Its up to you to implement some cunning code using that function. Or to hack it up and vastly improve it :)

ninja edit: I have 1337 skills.
 

iain7

Member
right... so when it says what 1,2 and 3 are. i need to put a little script saying if item is in collectables. txt, then send to the user. else, continue. This seems kind of difficult for me lol. anybody is there any new vocab i need to learn? =P
ok im stuck here. the collectables.ash says to use an item command wheras meatfarm.ash uses 1,2,3 etc. should i make a command to check for all items before i run through the other commands?

a little help would be great! but dont just give me the entire thing, just the complicated stuff. unless you WANT to do the entire thing ::)
 
Status
Not open for further replies.
Top