How to script it to send Gifts to people

Des80

Member
I want to send gifts through a script and was wondering how to do it. I tried using Zlib's but I dont think Im doing it correctly.
 

Bale

Minion
zlib's send_gift() function works great. How were you using it? The only slightly tricky thing about it is that you need to put the gifts into a map.
 

Des80

Member
Ok I think that is the issue I know its send_gift( string recipient , string message , int meat , int [item] goodies )
so I would do send_gift(User, "Heres your Sign", 0, int[item] goodies ) where goodies is a txt file that has Holiday Fun! in it but I guess thats where my problem is I don't know as much about Mapping as I want to. I know how to file to map and map to file. Thanks for any help you can give Bale I know I've been asking a lot of questions lately but I've been trying to expand my script writing and having fun with it.
Sorry I also want to mention I am importing zlib.ash into my script.
 

Theraze

Active member
Something like:
ash import <zlib.ash> int[item] stuff; file_to_map("filename.txt", stuff); send_gift("someone", "something for them to read", 0, stuff);

Replace filename.txt with the file name, someone with your target (i suggest yourself to test, initially at least), and something for them to read with whatever witty message you want.
 

Des80

Member
It doesnt seem to want to work says the message can't send for some reason so Im doing something wrong. I get red text that says 'The message didn't send for some reason.'
Code:
import <zlib.ash>;
void main() 
{
int[item] package;
file_to_map("goodies.txt", package);
send_gift( "username" , "This is a Test" , 0 , package );

}
 

Bale

Minion
Most probable errors: either "username" isn't a valid user or else "goodies.txt" is not formatted properly.

I really think that the problem is goodies.txt, but without seeing it, I cannot advise you on it. Each line needs to be an item, followed by a tab, followed by the number of that item to send. Like this:

Code:
Holiday Fun!	1
knuckle sandwich 	1
 

Des80

Member
Ok that helped me out I was doing the Number then a Tab then the Item itself. Let me see if it works now. Nope I still get the red Message 'The message didn't send for some reason.'


I am using a Friends Name who is in the clan chat with me so I know its legit.
 
Last edited:

Bale

Minion
Let's just test goodies.txt to make sure that it is legit. Check the CLI output for this little program:

Code:
void main() 
{
int[item] package;
file_to_map("goodies.txt", package);

print("Goodies Loaded.");
foreach it,x in package
   print("Want to send " + x + " of "+ it);
print("Done.");
}


I am using a Friends Name who is in the clan chat with me so I know its legit.

Does your friend's name have a space or any odd characters in it?
 
Last edited:

Des80

Member
all I got was
Goodies Loaded.
Done.

but I have what you need written in a txt file named goodies.txt

ARG nvm I know what was wrong the txt was with the Ash file but I subfolder certainscripts and it needs to be in the main Script Folder.
I have it working perfectly.

Thank you all for your help.
 
Last edited:

Bale

Minion
There is something wrong with your text file or else you would have gotten output that described its contents.

I'd suggest you attach it here so someone can figure it out. If you have privacy concerns, then you could PM me a link to see it.
 

Des80

Member
I got it working and figured out my error it was just a file in the wrong place. The only other question I have is if you have multiple items in the Map does it send multiple gifts or the bigger gift packages ? If it does give multiple gifts is there a way to send a gift with more then 1 item.
 

Bale

Minion
Glad you figured that out.

The only other question I have is if you have multiple items in the Map does it send multiple gifts or the bigger gift packages ?

Both. It will attempt to conserve meat spent on packages by using a plain brown package for 1 item, a less-than-three-shaped box for 2 items or else breaking down more than 2 items into multiples of the first two types of boxes since they get progressively more expensive.

eg. If you want to send 5 items to a person, it will do that with 2 less-than-three-shaped boxes and 1 plain brown package for a total shipping cost of 250 meat. (A miniature coffin to hold all 5 items would cost 1000 meat.)


If it does give multiple gifts is there a way to send a gift with more then 1 item.

I'm not really sure what you're asking.
 

Des80

Member
Awesome thanks Bale you've been awesome to me with all of my questions. ALong with everyone else who has helped me .
 
Top