Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Sending PMs by script? Editing player chat bar? (https://forums.graalonline.com/forums/showthread.php?t=64195)

jake13jake 02-18-2006 11:43 PM

Sending PMs by script? Editing player chat bar?
 
Okay, I have a few ideas to improve how players communicate to each other that I'd like to let the players on Classic have access to.

My questions are:
1. How do you send a pm/guild/mass message by script?
2. Are there any event handlers in the chat bar that would allow direct editing to the chat bar? (if there aren't this is going straight to future improvements)

xXziroXx 02-18-2006 11:47 PM

PM: sendpm("text");


You can edit the GFX of the chatbar.

jake13jake 02-19-2006 12:48 AM

Quote:

Originally Posted by xXziroXx
PM: sendpm("text");


You can edit the GFX of the chatbar.

1. wouldn't sendpm have a param for something like object, id or account?
2. I mean... editing the chat text as it's being typed... like if the player types << change it to <addhere< as the player types it.

Chicken_l33t 02-19-2006 02:43 AM

Quote:

1. wouldn't sendpm have a param for something like object, id or account?
When you use sendpm("message"); it comes from the NPC server to the client that initiated it.

So, just use with (findplayer(params[0])){
sendpm("Hello" SPC params[0] SPC "i love you!");
}

Ajira 02-19-2006 03:26 AM

Quote:

Originally Posted by Chicken_l33t
When you use sendpm("message"); it comes from the NPC server to the client that initiated it.

So, just use with (findplayer(params[0])){
sendpm("Hello" SPC params[0] SPC "i love you!");
}

zzz
When done from the clientside, it's like you're sending the PM.
I'm going to experiment using this.

jake13jake 02-19-2006 03:31 AM

You're not understanding.
One player PMs another player.
The PM comes from the other player
Script function to send PM from one player to the other player is what I'm asking about.

ZeLpH_MyStiK 02-19-2006 09:18 AM

Quote:

Originally Posted by jake13jake
You're not understanding.
One player PMs another player.
The PM comes from the other player
Script function to send PM from one player to the other player is what I'm asking about.

nonexistent.

Maniaman 02-19-2006 03:51 PM

When sendpm is used on the clientside, it is sending a pm from the current player.

The Chatbar is a GuiTextEditCtrl. It's name is ChatBar. So for example, you can change its x by doing ChatBar.x = 8675309;
Changing profile:
ChatBar.profile = "GuiBlueTextEditProfile";

Inverness 02-19-2006 05:52 PM

What functions did the V3 PlayerList use for PMs?

Ajira 02-19-2006 06:42 PM

Quote:

Originally Posted by Inverness
What functions did the V3 PlayerList use for PMs?

PHP Code:

function onPMSend(obj) {
  
obj.textedit.sendpm(obj.person)



hotrian 02-19-2006 09:03 PM

http://wiki.graal.us/Script_Functions:_Client
GuiPMEditCtrl (GuiMLTextEditCtrl):
sendmasspm(obj)
sendpm(obj)
GuiPMCtrl (GuiMLTextCtrl):
showpm(obj)
GuiPMHistoryCtrl (GuiMLTextCtrl):
showhistory(obj)

isguildpm() - returns boolean
ismasspm() - returns boolean
pmswaiting() - returns boolean

Hmm?

jake13jake 02-19-2006 11:34 PM

Quote:

Originally Posted by hotrian
http://wiki.graal.us/Script_Functions:_Client
GuiPMEditCtrl (GuiMLTextEditCtrl):
sendmasspm(obj)
sendpm(obj)
GuiPMCtrl (GuiMLTextCtrl):
showpm(obj)
GuiPMHistoryCtrl (GuiMLTextCtrl):
showhistory(obj)

isguildpm() - returns boolean
ismasspm() - returns boolean
pmswaiting() - returns boolean

Hmm?

hmm... so would I have to acquaint myself with the GUI bs to do this?

Ajira 02-20-2006 12:03 AM

Quote:

Originally Posted by jake13jake
hmm... so would I have to acquaint myself with the GUI bs to do this?

Basically, a new GuiPMEditCtrl would need to be created. Then you'd do CtrlName.sendpm("account") methinks.

Edit:
Okay so this interested me as well. You must create a new GuiPMEditCtrl() with the profile of GuiMLTextEditProfile or something like that. Then the contents of the Ctrl will be sent by using the CtrlName.sendpm(findplayer("account")) function. The F2 window will then show the "PM Sent" text.

Warcaptain 03-06-2006 01:44 AM

Quote:

Originally Posted by Ajira
zzz
When done from the clientside, it's like you're sending the PM.
I'm going to experiment using this.


this is a false statement :-x

Admins 03-06-2006 01:51 AM

If you want to send a pm directly to another client then you will need to use a GuiPMEditCtrl. This is to make sure the player is editing the text, scripts don't have access to the text of that Gui control.
If it's possible to manipulate the default chatbar then we will need to add a protection against that.
It wouldn't be good if scripts could send PMs in the name of the player, or send chat messages in the name of the player. Sometimes security is better than functionality. There are also reasons why the scripted RC doesn't have the same functionality like external RC yet.

jake13jake 03-06-2006 02:29 AM

Quote:

Originally Posted by Stefan
If you want to send a pm directly to another client then you will need to use a GuiPMEditCtrl. This is to make sure the player is editing the text, scripts don't have access to the text of that Gui control.
If it's possible to manipulate the default chatbar then we will need to add a protection against that.
It wouldn't be good if scripts could send PMs in the name of the player, or send chat messages in the name of the player. Sometimes security is better than functionality. There are also reasons why the scripted RC doesn't have the same functionality like external RC yet.

I mean like clientside scripts where the player is always accessible. Like instead of having to type
toguild: toall:, maybe if you typed "//tg" it would replace itself with "toguild:" or "//ta" would replace itself with "toall:"

perhaps having like "//sa" for showadmins. I mean like typing shortcuts.

"/account/ message" to send a PM to account.

It would be a good feature if you could send a PM through the chat bar from the selected players on the playerlist.

Maniaman 03-06-2006 02:32 AM

Quote:

Originally Posted by Stefan
If it's possible to manipulate the default chatbar then we will need to add a protection against that.

:frown:

If you are going to add protection, atleast allow us to edit its profile, x, y, width, height. I have done this on Maloria Dev if you have a certain NPC. Makes it much nicer, and lets it 'blend in' with the server better.

Warcaptain 03-06-2006 03:45 AM

Just script your own chat bar.. its not that hard.

Stefan, you just need to make it so that you can disable default chat.

ChatBar.destroy() works but returns this error when the player first presses tab and the bar is destroyed:
NPC Code:

GraalScript: Function setSelection not found in script of StartScript_GraalGui
GraalScript: Function makeFirstResponder not found in script of StartScript_GraalGui


Maniaman 03-06-2006 03:51 AM

Quote:

Originally Posted by Warcaptain
Just script your own chat bar.. its not that hard.

That could be done, but why do it when there is already one. I can see rescirpting it if you want a bunch of fancy new features, but just for changing the look of it, I see no reason to script a new one.

Warcaptain 03-06-2006 04:45 AM

Then possibly Stefan simply meant to make ChatBar.text read only?

I agree that there is no reason to make it entirely read only.

Ajira 03-06-2006 02:54 PM

Quote:

Originally Posted by Warcaptain
this is a false statement :-x

No it's not. You just need a GuiPMEditCtrl.

ApothiX 03-06-2006 03:42 PM

Hrm, if Stefan makes it so the chat bar cannot be edited, that will screw Thamhic's chat system right over :| It sets the ChatBar text to NULL when a player users a command, or sends a toguild, so that they can have privacy when doing these things.

Warcaptain 03-06-2006 08:08 PM

Quote:

Originally Posted by Ajira
No it's not. You just need a GuiPMEditCtrl.

Quote:

Originally Posted by Ajira
zzz
When done from the clientside, it's like you're sending the PM.
I'm going to experiment using this.

You were saying it would work with just sendpm clientside.

GuiPMEditCtrl's cant edit text, like jake13jake wanted.

Ajira 03-07-2006 01:50 AM

Quote:

Originally Posted by Warcaptain
You were saying it would work with just sendpm clientside.

GuiPMEditCtrl's cant edit text, like jake13jake wanted.

It might have been implied at first, but I never actually said it. :D

jake13jake 03-07-2006 02:16 AM

Quote:

Originally Posted by Warcaptain
You were saying it would work with just sendpm clientside.

GuiPMEditCtrl's cant edit text, like jake13jake wanted.

Well, I don't really need the ability to edit the text if the client can just edit what they have to type to send a toall or toguild, etc. It can probably be said that communication is the biggest glue graal has right now, might as well enhance it.

like... perhaps in Options have preferences for that.
toall="toall:" or toall="ta:"
toguild="toguild:" or toguild="//"
pm=":"@ACCOUNT@":"
macro_selectedlistplayers="<>"

like... just being able to edit that stuff and make macros, perhaps also letting the server add to defined macros that are unique to the server (In the same sense that I'm arguing to do with additional keycodes).
Another good macro would be
Owner of last PM received
Owner of last toall received
Owner of last toguild received
All members of some guild that are online

ApothiX 03-11-2006 03:10 AM

Quote:

Originally Posted by jake13jake
Well, I don't really need the ability to edit the text if the client can just edit what they have to type to send a toall or toguild, etc. It can probably be said that communication is the biggest glue graal has right now, might as well enhance it.

like... perhaps in Options have preferences for that.
toall="toall:" or toall="ta:"
toguild="toguild:" or toguild="//"
pm=":"@ACCOUNT@":"
macro_selectedlistplayers="<>"

like... just being able to edit that stuff and make macros, perhaps also letting the server add to defined macros that are unique to the server (In the same sense that I'm arguing to do with additional keycodes).
Another good macro would be
Owner of last PM received
Owner of last toall received
Owner of last toguild received
All members of some guild that are online

it's extremely easy to implement those shortcuts for toall and toguilds and such.

PHP Code:

function ChatBar.onAction(text) {
  if(
text.starts("//")) {
    
ChatBar.setText("toguild: " text.substring(2,-1).trim());
  } 
// etc



jake13jake 03-11-2006 03:36 AM

Unless you're like me and haven't looked into GUI elements yet. However, it would still be a very good feature to be built into the client.

Quote:

Originally Posted by ApothiX
it's extremely easy to implement those shortcuts for toall and toguilds and such.

PHP Code:

function ChatBar.onAction(text) {
  if(
text.starts("//")) {
    
ChatBar.setText("toguild: " text.substring(2,-1).trim());
  } 
// etc




ApothiX 03-11-2006 06:22 PM

Quote:

Originally Posted by jake13jake
Unless you're like me and haven't looked into GUI elements yet.

That's the beauty of it, I just showed you how.

Quote:

Originally Posted by jake13jake
However, it would still be a very good feature to be built into the client.

Not really, because some scripts that are already created rely on the fact that toguild: and toall: are used.

jake13jake 03-12-2006 12:27 AM

Quote:

Originally Posted by ApothiX
That's the beauty of it, I just showed you how.

Not really, because some scripts that are already created rely on the fact that toguild: and toall: are used.

That's the beauty of find/replace (all)

Bl0nkt 03-12-2006 01:33 AM

I have a question relating to this:

Is there a way to check if a PM is recieved from a certain player? Any player?

napo_p2p 03-12-2006 11:16 AM

Quote:

Originally Posted by Bl0nkt
I have a question relating to this:

Is there a way to check if a PM is recieved from a certain player? Any player?

HTML Code:

function onPM(p) {
  player.chat = "Got PM from: " @ temp.p.account;
}



All times are GMT +2. The time now is 09:37 PM.

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