mredge73
Member
Rahmus
Here is my sticky note function. You should be able to modify it to meet your needs.
I call it by a chatbot function in the middle of a switch:
(see the unofficial gamblebot script)
**These are copy/pasted from another script (excerpts). Don't expect them to work right out of the box.
My clan requested this feature but only used it for a short time.
Here is my sticky note function. You should be able to modify it to meet your needs.
Code:
//ChatBot Routines = Notetaking
//used to pass notes to other players through chat
//command order: 1 Add, 2 view, 3 erase, 4 count
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
string StickyNotes(int command, string sender, string message)
{
string Outgoing;
//Load Chatbot note taking Log
note[int] notelog;
File_to_Map("StickyNotes.txt",notelog);
//Add
if (command==1)
{
//parse out command
int spacing = index_of( message, "add notes:" ) + 10;
string cropped = substring( message , spacing );
//find new index
int newnote= count(notelog);
//write note to map
notelog[newnote].sender= sender+": ";
notelog[newnote].message= cropped;
//save new map
Map_to_File(notelog,"StickyNotes.txt");
Outgoing = "Added Note: "+cropped;
}
//view
if (command==2)
{
if (count(notelog)>0)
{
//PM the notelog to the sender
foreach note in notelog
if(my_name() != sender)
chat_private(sender, notelog[note].sender + notelog[note].message);
}
else
OutGoing= "The notelog is empty!";
}
//erase
if (command==3)
{
//pass an empty log to the file to erase it
note[int] emptylog;
Map_to_File(emptylog,"StickyNotes.txt");
OutGoing= "The notelog is empty!";
}
//count
if (command==4)
{
OutGoing= "There are "+count(notelog)+" notes on the notepad";
}
return OutGoing;
}
I call it by a chatbot function in the middle of a switch:
(see the unofficial gamblebot script)
Code:
//"add note" = adds note to the sticky note file
case contains_text( message, "add notes:" ):
Outgoing= StickyNotes(1,sender,message);
break ;
//"view notes" = sends PM to caller of all notes on file
case contains_text( message, "view notes" ):
Outgoing= StickyNotes(2,sender,message);
break ;
//"clear notes" = erases note file by passing empty map to file
case contains_text( message, "clear notes" ):
Outgoing= StickyNotes(3,sender,message);
break ;
//"count notes"= returns how many notes exist
case contains_text( message, "notes" ):
Outgoing= StickyNotes(4,sender,message);
break ;
**These are copy/pasted from another script (excerpts). Don't expect them to work right out of the box.
My clan requested this feature but only used it for a short time.
Last edited: