Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Buddy Communication System (https://forums.graalonline.com/forums/showthread.php?t=85250)

Gambet 04-21-2009 08:57 AM

Buddy Communication System
 
3 Attachment(s)
I made a system similar to something that was suggested here: http://forums.graalonline.com/forums....php?p=1485077

Basically, the system allows you to send mass messages to only your online buddies (same server) by either the gui-based method or the chat-based method. For the gui-based method, you will need to have the scripted playerlist enabled.

To enable the scripted playerlist:

F3 --> General --> Player list Options --> Check the box that reads "Use in-game playerlist"


If you have the scripted playerlist enabled, then simply right-click on any entry in the playerlist to bring up a new option for your popup menu: Message All Buddies

Click on this button to bring up a window similar to the mass-message window. Currently, only the 'Close' and 'Send' buttons work, the 'History' button does nothing but is there to make it easier to add functionality to it in the future. Simply type your message and press send.

For the chat-based method, simply say "tobuddies: <message here>" (without the braces) and your message will have sent.

I also added two separate features, which are a cooldown system to prevent spamming (currently a 15 second cooldown in-between messages which can be easily changed) and an ignoring feature that allows you to ignore all buddy mass messages.

Command for ignoring/allowing mass buddy messages: /bmsg ignore

Important Note: This system uses the NPC-Server to send messages between players so it requires you to not have the NPC-Server on ignore. Also, when installing this system, you will need to customize the onCreated() portion to your Control-NPC for when a player logs in since the scripted playerlist automatically removes any new rows that are not a part of the default system when you first log on. It is important that you do this or else the row will not appear when the player right-clicks someone on their playerlist.

PHP Code:

/*
 *Buddy Communication System
 *@author Gambet
 *NOTE: Requires the scripted playerlist
*/

function onActionServerSide(commandbuddyListmessagesender)
{
 if (
command == "sendBuddyMessage")
  {
   for (
pallplayers)
    {
     if (
p.account in buddyList)
      {
       if (
p.level.name != NULL)
        {
         if (
p.client.bmsg_ignore == false//Send message only if user allows mass buddy messages
           
p.sendPM("\nBuddy Message From" SPC sender ":\n\n" replaceText(message"\\n""#b"));
        }
      }
    }
  }
}

function 
replaceText(txtab//replaceText parser-function by DustyPorViva
{
 if (
txt.pos(a) < 0) return txt;
 
 
temp.txtpos txt.positions(a);
 
temp.newtxt txt.substring(0txtpos[0]);
 
 for (
temp.0txtpos.size(); i++) 
  {
   
newtxt @= b;
   
newtxt @= txt.substring(txtpos[i]+a.length(), txt.substring(txtpos[i]+a.length()).pos(a));
  }
  
 return 
newtxt;
}  

//#CLIENTSIDE
function onCreated()
{
 
this.customMenuEntry "Message All Buddies"//Row title
 
 
if (PlayerList_Menu.findtext(this.customMenuEntry) == -1)
  (
"-Playerlist").addCustomMenuEntry(1this.customMenuEntry);   
}

function 
onPlayerChats()
{
 if (
player.chat == "/bmsg ignore"//Toggle between allowing and ignoring mass buddy messages
  
{
   
client.bmsg_ignore = !client.bmsg_ignore;
   
player.chat "Mass Buddy Messages: " @ (client.bmsg_ignore == false "Allowed" "Ignored"); 
  }
 else if (
player.chat.starts("tobuddies:")) //Chat-based mass buddy messages
  
{
   if (
this.bmsg_cooldown <= timevar2)
    {
     
temp.messageToSend player.chat.substring(10);   
     
triggerserver("gui"name"sendBuddyMessage"findPlayerBuddies(), messageToSendplayer.account);
     
player.chat "";
     
this.bmsg_cooldown timevar2 15;
    }
   else
    {
     
player.chat "You can't send another buddy mass for another" SPC int(this.bmsg_cooldown timevar2SPC "second(s)!";
    }
  }
}

function 
PlayerList_Menu.onSelect(entryidtext
{
 if (
text == this.customMenuEntrytoBuddyGUI(); //If user selects 'Message All Buddies'
}

function 
toBuddyGUI()
{
 new 
GuiWindowCtrl("ToBuddy_Window")  
  { 
   
profile GuiBlueWindowProfile
   
= (screenwidth/100); 
   
= (screenheight/2-100); 
   
width 425
   
height 370
   
canclose "false";
   
text "Message To Buddies"
   new 
GuiScrollCtrl("ToBuddy_Scroll")  
    { 
      
profile GuiBlueScrollProfile
      
5
      
22
      
width 413
      
height 305
      
hScrollBar "alwaysOff"
      
vScrollBar "dynamic"
     new 
GuiMLTextEditCtrl("ToBuddy_ScrollText")  
      { 
        
useownprofile true
        
profile "GuiBlueTextProfile"
        
8
        
5
        
height 40
        
width 405
      } 
    }
    new 
GuiButtonCtrl("ToBuddy_CloseButton")  
    { 
     
profile GuiBlueButtonProfile
     
20
     
335
     
width 90
     
height 25
     
text "Close"
    }  
    new 
GuiButtonCtrl("ToBuddy_HistoryButton")  
    { 
     
profile GuiBlueButtonProfile
     
117
     
335
     
width 90
     
height 25
     
text "History"
    }  
    new 
GuiButtonCtrl("ToBuddy_SendButton")  
    { 
     
profile GuiBlueButtonProfile
     
305
     
335
     
width 97
     
height 25
     
text "Send"
    }  
  }
}

function 
ToBuddy_CloseButton.onAction()
{
 
ToBuddy_Window.destroy();
}

function 
ToBuddy_SendButton.onAction()
{
 
temp.messageToSend ToBuddy_ScrollText.text;
 
ToBuddy_Window.destroy();
 
 if (
this.bmsg_cooldown <= timevar2)
  {
   
triggerserver("gui"name"sendBuddyMessage"findPlayerBuddies(), messageToSendplayer.account);
   
this.bmsg_cooldown timevar2 15;
  }
 else
  {
   
player.chat "You can't send another buddy mass for another" SPC int(this.bmsg_cooldown timevar2SPC "seconds!";
  }
}

function 
findPlayerBuddies()
{
 
temp.buddiesOnline ""
 
 for (
pallplayers)
  {
   if (
p.isbuddy)
    {
     if (
buddiesOnline.index(p.account) == -1)
      
buddiesOnline.add(p.account); //Array of user's online buddies
    
}
  }
 
 return 
buddiesOnline;



Edit: Here are some screenshots:




Feel free to customize it as you please.

napo_p2p 04-21-2009 09:10 AM

I haven't tried it out, but it looks legit to me.

Nice :).

Gambet 04-21-2009 09:12 AM

I added some screenshots of the gui-based aspect for people to see what it looks like. :)

Tigairius 04-21-2009 09:55 AM

Cool :)

fragman85 04-21-2009 12:28 PM

Nice, but the problem is that the NPC-Server sends them.
Still, I know, there's no other way ;)

xXziroXx 04-21-2009 12:37 PM

Or, you could just, hold shift to select all buddies then press enter to send the selected buddies a mass message? :noob:

fragman85 04-21-2009 12:45 PM

Quote:

Originally Posted by xXziroXx (Post 1485676)
Or, you could just, hold shift to select all buddies then press enter to send the selected buddies a mass message? :noob:

A lot of my buddys have Mass Messages off :p

Well, this is no place for this discussion :o

Unkownsoldier 04-21-2009 02:30 PM

That's why if you use, tobuddies: message here, it gives the message to all of them

fragman85 04-21-2009 03:14 PM

Quote:

Originally Posted by Unkownsoldier (Post 1485697)
That's why if you use, tobuddies: message here, it gives the message to all of them

Could you please first read then post?
Thank you.

xXziroXx 04-21-2009 03:58 PM

Quote:

Originally Posted by fragman85 (Post 1485684)
A lot of my buddys have Mass Messages off :p

So basically it's a script that overrides peoples settings just so you can annoy them with meaningless messages? :oo:

Unkownsoldier 04-21-2009 04:05 PM

Quote:

Originally Posted by fragman85 (Post 1485684)
A lot of my buddys have Mass Messages off :p

Well, this is no place for this discussion :o


Can you read, I was explaining that there is no reason to give your buddies a mass message when you can do tobuddies:

fragman85 04-21-2009 04:27 PM

I thought you were answering my post, sorry.

Quote the person you're talking to next time :p

Gambet 04-21-2009 06:18 PM

Quote:

Originally Posted by xXziroXx (Post 1485676)
Or, you could just, hold shift to select all buddies then press enter to send the selected buddies a mass message? :noob:

Quote:

Originally Posted by xXziroXx (Post 1485714)
So basically it's a script that overrides peoples settings just so you can annoy them with meaningless messages? :oo:


You can do the exact same thing to send mass messages but there's a mass message button for mere convenience. This system also has its own ignoring feature to where you can disable the messages yourself if you find them annoying, and it has chat-based functionality if you feel like sending quick messages (aside from the gui-based functionality). With this system, you can ignore mass messages but allow buddy-mass messages so that your buddies can communicate with you more easily and you don't have to worry about having unknown players spamming your messages with useless masses.

Some players requested a system like this and so I made it, I don't see where the attitude is coming from and quite frankly I would expect so much more from you. Please stop derailing the thread from its original intentions, the code itself has a lot of nice pointers that people could use to learn from.

Elizabeth 04-21-2009 07:28 PM

Quote:

Originally Posted by xXziroXx (Post 1485676)
Or, you could just, hold shift to select all buddies then press enter to send the selected buddies a mass message? :noob:

i agree. there's no need for a buddy mass messaging system.

Loriel 04-21-2009 08:02 PM

It is basically like a reverse twitter

xXziroXx 04-21-2009 09:12 PM

Quote:

Originally Posted by Gambet (Post 1485758)
Some players requested a system like this and so I made it

That's fine and all, but...

Quote:

Originally Posted by Gambet (Post 1485758)
I don't see where the attitude is coming from and quite frankly I would expect so much more from you. Please stop derailing the thread from its original intentions, the code itself has a lot of nice pointers that people could use to learn from.

... I'm still entitled to my own opinion, and I still think this is quite useless. Stop getting so defensive for getting some critique, not everyone is forced to agree with you or approve things you create.

Gambet 04-21-2009 09:25 PM

Quote:

Originally Posted by xXziroXx (Post 1485835)
... I'm still entitled to my own opinion, and I still think this is quite useless. Stop getting so defensive for getting some critique, not everyone is forced to agree with you or approve things you create.

There's a difference between constructive criticism and derailment and how you chose to word your opinion was out-of-line. I don't need you to approve of the system nor would I care for your approval, I simply made it because some players requested it and figured it wouldn't hurt to give them what they wanted.

The Mass PM button is useless in your standards but is there for convenience. I never stated that this was a necessity but more a commodity that shouldn't bother anyone and definitely shouldn't be shot down because there are some players that would find it beneficial.

Things don't always have to benefit you in particular to be considered useful and it's a shame that you aren't looking at things in context of the players that actually would use it, instead of simply stating that you would never use it and claiming it to be useless. There's nothing wrong with making it easier to do things you can currently do.

Inverness 04-21-2009 09:34 PM

Quote:

Originally Posted by xXziroXx (Post 1485676)
Or, you could just...

Quote:

Originally Posted by xXziroXx (Post 1485714)
So basically it's...

You're being a jerk.

fowlplay4 04-21-2009 11:20 PM

Neat, never really looked into modifying the scripted Playerlist but I'm more of a external playerlist kinda guy.

There's this way as well (I'd name it.. /buddymass), so long as your buddies don't have mass ignored.

PHP Code:

//#CLIENTSIDE
function onBuddyMass() {
  for (
temp.pallplayers) {
    if (
temp.p.isbuddy)
     
temp.budz.add(temp.p);
  }
  (
"-Playerlist").openPMWindow(temp.budz,false);




All times are GMT +2. The time now is 01:27 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.