Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   help with openexternalpm() (https://forums.graalonline.com/forums/showthread.php?t=86847)

Angel_Light 07-12-2009 07:48 AM

help with openexternalpm()
 
ok, so I'm just working with some stuff and I try to get a pm window open when a player just double clicks another, here's what I got:

PHP Code:

//#CLIENTSIDE

//...script...

function onMouseDown()
{

  if ( 
params0] == "double")
  {

    
this.pID getPlayerIDmousexmousey);
    
    if ( 
this.pID != -&& this.pID != player.id)
    {

        
playersthis.pID].openexternalpmfalse);

    }
  }
}

function 
getPlayerIDtemp.mxtemp.my)
{

  for ( 
temp.0allplayerscount++)
  {
  
    if ( 
mx in playersp].xplayersp].2|  &&
         
my in playersp].yplayersp].3|)
      return 
playersp].id;

  }
  
  return -
1;


From what I can tell it should work, but when I double click nothing happens at all. What am I doing wrong?

DustyPorViva 07-12-2009 07:56 AM

PHP Code:

//#CLIENTSIDE
function onMouseDown() {
  if (
leftmousebutton) {
    (
"-Playerlist").openexternalpm({findplayerbyid(testplayer(mousex,mousey))},false);
  }


Should work, though I didn't test it. Though I just realized testplayer doesn't work in nopk zones(do to testplayer works by checking for where players block), but I'm sure you get the idea.

Angel_Light 07-12-2009 08:24 AM

No dice, still nothing happens

DustyPorViva 07-12-2009 08:27 AM

Try this, have someone PM you and chat "checkpms"...
PHP Code:

//#CLIENTSIDE
function onPlayerchats() {
  
temp.checkacc "DustyPorViva"replace this with the account of the person PMing you
  
if (player.chat == "checkpms") ("-Playerlist").openexternalpm({findplayer(checkacc)},false);


If that doesn't work I dunno, because that's the syntax I use in my map script.

Skyld 07-12-2009 12:07 PM

I have made the ("-Playerlist").anypmswaiting() a public function so that should return if there are any unread PMs.

The correct format is to use ("-Playerlist").openPMWindow({array of player objects}, bool ismasspm); (note the ismasspm value is ignored if reading a received PM). On the current client this may not always produce an external PM window as currently shown on the Windows client, but the TServerPlayer.openexternalPM(bool display PM) function doesn't work properly on Mac or Linux I don't think (where the scripted playerlist is used already).

In the next client the scripted playerlist windows are all external by default anyway. Tig has also made some changes to the scripted playerlist in an attempt to make it more like the Windows one (which is currently uploaded on Login 2).

cbk1994 07-12-2009 12:40 PM

Quote:

Originally Posted by Skyld (Post 1506316)
In the next client the scripted playerlist windows are all external by default anyway. Tig has also made some changes to the scripted playerlist in an attempt to make it more like the Windows one (which is currently uploaded on Login 2).

I hope we can still use the current docking one?

Skyld 07-12-2009 10:07 PM

Quote:

Originally Posted by cbk1994 (Post 1506321)
I hope we can still use the current docking one?

In the new client the Delphi external windows are gone. Every client will use the same scripted playerlist with the same external windows support. It would be possible to make the scripted windows dockable which would produce the same effect.

cbk1994 07-12-2009 10:17 PM

Quote:

Originally Posted by Skyld (Post 1506431)
In the new client the Delphi external windows are gone. Every client will use the same scripted playerlist with the same external windows support. It would be possible to make the scripted windows dockable which would produce the same effect.

:\

The scripted one is glitchy, clumsy, and ugly. Something tells me a lot of people aren't going to be happy using it, including me.

Skyld 07-13-2009 12:10 PM

Quote:

Originally Posted by cbk1994 (Post 1506434)
The scripted one is glitchy, clumsy, and ugly. Something tells me a lot of people aren't going to be happy using it, including me.

I have been using the scripted playerlist for years and have not found it to be "glitchy". The design, however, could be improved and that's what Tig's been working on addressing. As for ugly, well, it follows whatever theme you have the rest of the client using. If you want to change the theme, you are at liberty to do so.

It doesn't make sense to have a Delphi playerlist on the Windows client and not on the Mac and Linux clients though because then we have to implement a Gtk and a Cocoa playerlist separately in addition, and that makes code portability a nightmare and updating the playerlist logic even more of a nightmare.

cbk1994 07-13-2009 12:16 PM

Quote:

Originally Posted by Skyld (Post 1506631)
I have been using the scripted playerlist for years and have not found it to be "glitchy". The design, however, could be improved and that's what Tig's been working on addressing. As for ugly, well, it follows whatever theme you have the rest of the client using. If you want to change the theme, you are at liberty to do so.

I can't change the theme of it without changing the theme of everything else apparently.

I find it quite glitchy, especially on Mac, though that's probably mostly the external windows - mainly focus problems, clicking doesn't select, you have to click once to select the window, then click again to select.

Quote:

It doesn't make sense to have a Delphi playerlist on the Windows client and not on the Mac and Linux clients though because then we have to implement a Gtk and a Cocoa playerlist separately in addition, and that makes code portability a nightmare and updating the playerlist logic even more of a nightmare.
It may not make sense if you think about it like that. However, think about it like a player. You don't care if something makes sense or not to the developer, you just want it to work well and look nice. I have a feeling it's going to definitely be a downgrade going from the Graal v5 playerlist to the in-game one.

Skyld 07-13-2009 12:33 PM

Quote:

Originally Posted by cbk1994 (Post 1506632)
I can't change the theme of it without changing the theme of everything else apparently.

That is something we can look into if there is enough demand for the ability to change the theme of the playerlist separately.
Quote:

Originally Posted by cbk1994
I find it quite glitchy, especially on Mac, though that's probably mostly the external windows - mainly focus problems, clicking doesn't select, you have to click once to select the window, then click again to select.

The external windows in the most recent Mac client are working very well for me. The controls do not select at the same time as the windows focus because that is default behaviour in OS X for control-less windows (since the external window contents are essentially bitmap framebuffers). Stefan can make that optional I guess (since a click event could be passed as well as a window focus event).
Quote:

Originally Posted by cbk1994
It may not make sense if you think about it like that. However, think about it like a player. You don't care if something makes sense or not to the developer, you just want it to work well and look nice. I have a feeling it's going to definitely be a downgrade going from the Graal v5 playerlist to the in-game one.

Matching the functionality of the external playerlist is the aim of the improved script on Login 2 so that when the new client is released, people should not have to relearn anything to use the playerlist just as they always have.

DustyPorViva 07-13-2009 12:40 PM

Scripted things like the playerlist wouldn't be so bad if the GUI's were more responsive like the real OS counterparts. They always feel like they're scripted rather than being part of the 'real' interface, if that makes sense.

Crow 07-13-2009 01:24 PM

Selecting also doesn't work in the scripted playerlist. Holding shift while selecting players just "adds" more to the selection, while holding ctrl should do that job, and shift should select a range between click one and click two. Ctrl does nothing. That's my main concern.

Gambet 07-13-2009 03:00 PM

I'm not a fan of the scripted playerlist, and the login 2 one doesn't look much different. Also, there's an 'Options' button on the login 2 playerlist but it opens up a Mass PM when you click it, might want to look into that.

As for the removal of the dockability, that's a rather huge downgrade considering the amount of positive feedback that came from it when it was first released. Personally, I always have my playerlist docked to the side when I'm on.

Tigairius 07-14-2009 03:19 AM

Quote:

Originally Posted by Crow (Post 1506647)
Selecting also doesn't work in the scripted playerlist. Holding shift while selecting players just "adds" more to the selection, while holding ctrl should do that job, and shift should select a range between click one and click two. Ctrl does nothing. That's my main concern.

That's fixed on the new version.

Quote:

Originally Posted by Gambet (Post 1506652)
I'm not a fan of the scripted playerlist, and the login 2 one doesn't look much different. Also, there's an 'Options' button on the login 2 playerlist but it opens up a Mass PM when you click it, might want to look into that.

As for the removal of the dockability, that's a rather huge downgrade considering the amount of positive feedback that came from it when it was first released. Personally, I always have my playerlist docked to the side when I'm on.

The options window is only available if you're using the new client.


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

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