Author Topic: Send Art and Emotes  (Read 2476 times)

Offline saquivor

  • BFF
  • ***
  • Posts: 110
    • View Profile
Send Art and Emotes
« on: September 12, 2006, 02:16:00 AM »

This is an update to a previous post on lpuni with a thread title of a bit of

 fun. I have updated this version to normal functions instead of call_out!



After copying the code you will also need this zip http://www.monkeyx.net/txt.zip">file to save ascii art to your txt domain folder.



LPC code:

/* /domains/whatever/obj/sendart.c
* Please modify string domlabel, added this
* to make it clearer that path to files needs
* to be changed to use program.
* You will need to save the associates art files
* in /domains/whatever/txt
* Tested on Dead Souls 2.1
* Allows you to send ascii art and emotes to other
* players.
* saquivor@monkeyx.net
* September 10, 2006
*/

#include <lib.h>
#include <vendor_types.h>
inherit LIB_ITEM;
int CallArt(string str,string plyr);
int CallEmote(string str,string plyr);
string domlabel="/domains/highlands";

void create(){
::create();
SetKeyName("artbox");
SetId( ({"art","box","art box"}) );
SetShort("Art %^BOLD%^%^BLUE%^Box%^RESET%^ %^YELLOW%^v00a%^RESET%^");
SetLong("This is a magical art box you can use it to send images and emotes to people\n"+
"in distant locations.\nValid uses are as follows:- abox command player"+
"\nValid picture commands are thistle,rose,hammer,love"+
"\nValid Emotes are wink,nod,wave"+
"\n\nExample 'abox thistle player'\n");
SetMass(10);
SetBaseCost("silver",0);
SetVendorType(VT_TREASURE);
}
int abox(string str){
string *words;
int psize;

if(!str) return notify_fail("Syntax: abox action player\n");
str=replace_string(str," ", " ");
str=replace_string(str," ", " ");
words = explode(str, " ");
psize=sizeof(words);
if (psize<2) return notify_fail("Please supply a name as well!\n");
//check you are holding object and you only?
if(present(this_object()->GetKeyName(),this_player()) && str){
switch (str=lower_case(words[0])){
case "thistle": case"thistles":case"rose":case"hammer":case"love":
CallArt(str,words[1]);
break;
case "wink": case"nod":case"wave":
CallEmote(str,words[1]);
break;
default:
write("\nPortal art box beeps\a three times and start to flash.\n\n"+
"A mechanical voice annouces that %^RED%^%^BOLD%^" + str +
"%^RESET%^ is not valid for art box!");
}

write("\nMccloud Technologies reserve all rights.\n");

return 1;
}

}
void init(){
::init();
// do by action ie thistle player (check for name)
// deposit thistle on person ?
add_action("abox","abox");
}

int CallArt(string str,string plyr){
string amessage;
object ob;
ob=find_player(plyr);
// Check for blank name , invis or creator Then do not send message.
if (!ob || ob->GetInvis() || creatorp(ob)){
write(capitalize(plyr)+
" is not a mortal member of this reality, or invisible!");
return 0;
}
if(!file_exists(domlabel+"/txt/"+str+".txt")) {
write ("file i/o error oops, please let an admin know.");
return 0;
}
else
{
amessage=read_file(domlabel+"/txt/"+str+".txt");
tell_player(plyr,amessage);
tell_player(plyr,this_player()->GetName()+" sent you a "+str+".");
write("\nYou sent a "+str+" to "+capitalize(plyr)+"\n") ;
return 1;
}
}
int CallEmote(string str,string plyr){
string amessage;
object ob;
ob=find_player(plyr);
// Check for blank name , invis or creator Then do not send message.
// Yet to check for ear muff compatibility
if (!ob || ob->GetInvis() || creatorp(ob)){
write(capitalize(plyr)+
" is not a mortal member of this reality, or invisible!");
return 0;
}
//add check for sending things to yourself.
amessage=this_player()->GetName()+" %^BOLD%^%^ORANGE%^"+
str+"s%^RESET%^ at you from afar !!!";
tell_player(plyr,amessage);
write("\nYou "+str+" at "+capitalize(plyr)+"\n") ;
return 1;
}




Offline saquivor

  • BFF
  • ***
  • Posts: 110
    • View Profile
Send Art and Emotes
« Reply #1 on: September 12, 2006, 02:21:24 AM »
Hmm I would like to edit my post, now I have enabled html post on my profile  :-$  Is this possible?

daelaskai

  • Guest
Send Art and Emotes
« Reply #2 on: September 12, 2006, 09:15:48 AM »

Editing should now be enabled here.



 



A.T

(-)



The Ultimate Galaxy I