Request of Specific Bots

codster62

Member
Hi, I am not to much of a scripting guru, so I need someone to make some bots for me. I am looking for:

ChefBot for my clan
Boozebot for my clan
Other Usefull Bots for my clan

Thanks, and, I am broke in kol right now, but I might be able to give something later.




P.S. - Anybody looking to trade a Mr. A for my Dragon Fable Account with a Dragon Amulet($20.00), Message me...
 

DaMaster0

Member
Well I'm just a beginner, but my script(should be a link to that in my sig) does something like that. I might be able to work it out, but I need more information. I have never heard of a chefbot before, so I need some info on that. Does it send food to your clanmates? What kind of food do you want it to send? Do you want it to ask for a certain amount of meat?

Oh. I probably missed you. I didn't realize this thread was a month old.
 
Last edited:

codster62

Member
Thank god somebody replied. Well, the type of scripts I am looking for are like smashbot...

Boozebot- Somebody sends ingrediants, and the boozebot will try to create whatever is possible out of these ingrediants.

Chefbot- A clannie sends ingrediants and the chefbot shall craft something out of those ingrediants.
 

zarqon

Well-known member
I don't have the time to work on something like this at the moment, but I can give some advice:

1) Look at my Script Registry thread for a nice kmail parser. It works nicely and hasn't needed editing in over a year.
2) Include ZLib for some very handy kmail-sending functions with useful return values.
3) It should all just be one bot, not separate bots for each skill. MakeThingsBot -- makes whatever it can using the ingredients sent.
4) The ASH function get_ingredients() is useful since it returns the ingredients necessary to make an item. Unfortunately, there's no reverse function like are_ingredients_of(), so you will have to iterate over ALL tradeable items to determine what items can be made from the items sent, build a list of possible items, and create the item(s) that uses the most of the ingredients sent.
5) Of course, run the bot on an account with the skills required. Also, moxie class (access to the Still), muscle sign (free crafting).

Good luck! I'm leaving for vacation tomorrow. w00t
 

DaMaster0

Member
I'm not sure if I'm going to be able to do this. I am having trouble using zarqon's registry code.
Code:
string[int] parse_mail() {
   string[int] parsedmail;
  // get a map of kmail in html
   print("Checking mail...");
   string temp = visit_url("messages.php");
   if (contains_text(temp,"There are no messages in this mailbox.")) return parsedmail;
   temp = substring(temp,index_of(temp,"checkbox name=\"")+15);
   string[int] km = split_string(temp,"checkbox name=\"");
   int p = 0;
   for i from 0 upto count(km)-1 {
     if (contains_text(km[i],"")) {
           // parse html into record structure
            parsedmail[p].id = to_int(substring(km[i],0,index_of(km[i],"\"")));
            parsedmail[p].text = excise(km[i],"<blockquote>","</blockquote>");
            temp = substring(km[i],index_of(km[i],"showplayer.php"));
            parsedmail[p].sender = url_encode(substring(temp,index_of(temp,">")+1,index_of(temp,"</a>")));
            temp = substring(km[i],index_of(km[i],"<b>Date:</b> ")+13);
            parsedmail[p].date = url_encode(substring(temp,0,index_of(temp,"<")));
            p = p+1;
         }
   }
   print(count(parsedmail)+" messages queued.","blue");
   return parsedmail;
}
I don't really understand his parse_mail() function. I'll keep trying, but you should probably look for a better programmer.
 

mredge73

Member
well if you look at that function buy itself you will have trouble understanding it.
I am about to release a new version of my function support script that will have elements of Zarqon's parse mail included in it in easy callable functions.

1. Zarqon's parse_mail function is a message[int] not a string[int]
here is my version of the message type with my edited version of parse_mail:
Code:
//message record
record message 
{
   string sender;
   string date;
   int id;
   string text;
   int meat;
   int[item] things;
};

//Parse_Mail by Zarqon
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
message[int] parse_mail() 
{
    message[int] parsedmail;
    print("Checking mail...");
    string temp = visit_url("messages.php");
    if (contains_text(temp,"There are no messages in this mailbox."))
        return parsedmail;
    temp = substring(temp,index_of(temp,"checkbox name=\"")+15);
    string[int] km = split_string(temp,"checkbox name=\"");
    int p = 0;
 
    for i from 0 upto (count(km)-1) 
    {
        parsedmail[p].id = to_int(substring(km[i],0,index_of(km[i],"\"")));
        parsedmail[p].text = excise(km[i],"<blockquote>","</blockquote>");
        temp = substring(km[i],index_of(km[i], "showplayer.php"));
        parsedmail[p].sender = url_encode(substring(temp,index_of(temp,">")+1,index_of(temp,"</a>")));
        temp = substring(km[i],index_of(km[i], "<b>Date:</b> ")+13);
        parsedmail[p].date = url_encode(substring(temp,0,index_of(temp,"<")));
        parsedmail[p].meat = extract_meat( km[i] );
        parsedmail[p].things= extract_items( km[i] );    
        p = p+1;
    }
   print(count(parsedmail)+" messages queued.","blue");
   return parsedmail;
}
Ok
to learn how to use this powerful function do this to test:
Code:
message[int] mail = parse_mail();
print ("checked mail");
if (count(mail) > 0) 
{
    print (mail[0].sender); 
    print (mail[0].date); 
    print (mail[0].id); 
    print (mail[0].text);
    print (mail[0].meat); 
    foreach i in mail[0].things
        print (mail[0].things[i]+ " "+i); 
}
parse_mail()
What this will do is read all of your Kmail and creates a record of it in the message type format, in other words it reads it and separates the parts out. That is the beauty of Zarqon's function.

The test function above will display all info about your last kmail received.


Now that you have it you can view each of your kmails one at a time.
So to find out how much meat was sent to you on your last kmail: mail[0].meat
and the one before it: mail[1].meat
etc...

Send yourself a few kmails with different things in them and try it out, if you have any questions ask.

It is part 4 of writing this script that will be difficult, I haven't seen any examples of a script that does that on this board.
It will take a long time to run since it will have to iterate all items and get their ingredients every time it is run, senders will have to wait a couple of minutes before it will be able to process the items. Nevertheless, it would be a pretty neat bot and a good exercise for someone new to build.
 
Last edited:

codster62

Member
Well, none of that made much since to me, but that is because I just don't have the patience to learn something new at the moment. Anyways, good luck. If you guys have something similar to the script(s) I was wanting(Chefbot and BoozeBot), then please post it in .ASH form so I can test it out. :)
 

mredge73

Member
I guess I am wasting my time writing these little tutorials/explanations if you are not interested in learning anything. Good luck getting someone to give away a bot, most script authors on this forum keep their bots to themselves and for their own clan.
 

codster62

Member
well, I am interested in learning and always enjoy the feedback posts. Some stuff just doesn't make sense to me unless I spend about an hour finding out every aspect of a simple thing. Sorry if you felt I didn't appreciate it. :)
 

DaMaster0

Member
Well, I sure liked your help. I need to get this working! I have problem were it can't recognize message[int]. That's why I changed it to string[int]. Can I have some help plz?

>call test.ash

Unknown variable 'message' (test.ash, line 3)
 
Last edited:

mredge73

Member
you have to declare the message type.
message is a maptype similar to a class.

I declared it at the top of my post. Follow my directions on the last post, copy/paste the function, declaration, and test in a .ash and call it to see how it works.

Here I did it for you:
 

Attachments

  • test2.ash
    1.7 KB · Views: 64
Last edited:

Grotfang

Developer
4) The ASH function get_ingredients() is useful since it returns the ingredients necessary to make an item. Unfortunately, there's no reverse function like are_ingredients_of(), so you will have to iterate over ALL tradeable items to determine what items can be made from the items sent, build a list of possible items, and create the item(s) that uses the most of the ingredients sent.

Surely this can be avoided by demanding the kmail contain the name of the item needed. All that would then be required would be to plug that into get_ingredients() and check to confirm that they sent the correct ones. This would limit the bot in that it couldn't optimize production and could also only handle one recipe at a time (although multiple iterations of the same recipe would be fine), but in some respects that may be preferable anyway. Stops someone sending a ton of items over to see what they get.
 

DaMaster0

Member
Surely this can be avoided by demanding the kmail contain the name of the item needed. All that would then be required would be to plug that into get_ingredients() and check to confirm that they sent the correct ones. This would limit the bot in that it couldn't optimize production and could also only handle one recipe at a time (although multiple iterations of the same recipe would be fine), but in some respects that may be preferable anyway. Stops someone sending a ton of items over to see what they get.

That's exactly what I was going to do. I was looking for something like get_ingredients() so thank you! I'll just do some testing with it, I'll be able to make a clanbot!
 

mredge73

Member
I thought that the purpose of your script was to be able to send a bunch of junk to the bot and have it build what ever it could?

Sounds like you guys changed the scope of the project...
if you told it to build you a chef in a box and you sent it all of the ingredients to do that, then why not build it yourself?

From what you guys are proposing now I could build that bot in about an hour...
 
Last edited:

codster62

Member
I don't know if I can do this, but I would like all further discussion about this script to be stopped. I am going to be working on something with a friend. Thanks for all input...
 

DaMaster0

Member
Sorry codster, I know you want discussion to be stopped. I sent you the script via private message a while ago, but you haven't replied. Plz check your inbox.
 
Top