Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Control-NPC PM Responding (https://forums.graalonline.com/forums/showthread.php?t=76161)

bscharff 08-07-2007 11:47 PM

Control-NPC PM Responding
 
OK, I'm Making An Event System Similar To Era's, Without The GUI That Pops Up.
I Have The Weapon Finished and Working But I Just Need To Get The If Player PM The Server Saying "join" then it warps them to the level defined in serverr.event
I Have This:

if (pm){
if (strequals(#p(0),join)){
setlevel2 serverr.event[1],serverr.event[2],serverr.event[3];
}
}

I Have Also Tried

function onPM
if (params[0] == "join"){
setlevel2(serverr.event[1],serverr.event[2],serverr.event[3]);
}
}

Any Suggestions, Fixes, or Alternatives?

Chompy 08-08-2007 12:04 AM

PHP Code:

function onPM(footext) {
  switch(
text) {
    case 
"join":
      
setlevel2(serverr.event[1], serverr.event[2], serverr.event[3]);
    break;
  }



MegaSizzler 08-08-2007 12:41 AM

That doesn't work at all (I work on bscharff's server). We've tried many alterations, even made it as simple as:
NPC Code:

function onPM(foo, text) {
this.sendPM("HI!");
}


Nothing works, it just replies with the default "Hey I'm the NPC server and I control most of the NPC's". Any ideas?

DustyPorViva 08-08-2007 12:48 AM

And this is in the Control-NPC?

xXziroXx 08-08-2007 12:54 AM

function onPM no longer works since v5 was released.

Chompy 08-08-2007 01:04 AM

Quote:

Originally Posted by xXziroXx (Post 1338226)
function onPM no longer works since v5 was released.

:(

Twinny 08-08-2007 01:22 AM

Quote:

Originally Posted by xXziroXx (Post 1338226)
function onPM no longer works since v5 was released.

Zodiac seems to have it working. Try pm'ing it classtree. I doubt a new client release would effect the server :whatever:

xXziroXx 08-08-2007 01:35 AM

That's odd. I know it stopped working on a lot of servers when v5 was released, you can even find several threads on the forum talking about it.

But yeah, it seems to be working on Zodiac..

PHP Code:

function onPM() {
  
sendPM("Thanks for PMing me!");



Angel_Light 08-08-2007 04:51 AM

Quote:

Originally Posted by Chompy (Post 1338216)
PHP Code:

function onPM(footext) {
  switch(
text) {
    case 
"join":
      
setlevel2(serverr.event[1], serverr.event[2], serverr.event[3]);
    break;
  }



What is foo?

DustyPorViva 08-08-2007 05:15 AM

I think the player's account name, but in this case is not needed.

Chompy 08-08-2007 10:57 AM

Quote:

Originally Posted by DustyPorViva (Post 1338258)
I think the player's account name, but in this case is not needed.

yep :)

bscharff 08-08-2007 08:39 PM

OK,
I Found out The Problem.
Since I Was Doing setlevel2 on it's own with no this. or player. it didn't know what to do.
So Mog put player.setlevel2(L,X,Y); it's works fine :P
Thanks Guys!

cbk1994 08-10-2007 03:46 AM

Thought I'd nought, for onPM to be called, I'm pretty sure in the onCreated, or such function, you need setPM( NULL );

xXziroXx 04-16-2008 02:46 AM

Bump alert, but it might prevent similar threads in the future.

If you do NOT have setPM(""); in your Control-NPC, function onPM() will not be triggered.

So, if function onPM() doesn't work for ya, simply do setPM(""); in your Control-NPC's onCreated() function.

cbk1994 04-16-2008 05:47 AM

Quote:

Originally Posted by xXziroXx (Post 1386142)
Bump alert, but it might prevent similar threads in the future.

If you do NOT have setPM(""); in your Control-NPC, function onPM() will not be triggered.

So, if function onPM() doesn't work for ya, simply do setPM(""); in your Control-NPC's onCreated() function.

Why did we need to bump this? :confused:

I basically said put it in onCreated in the last post.

xXziroXx 04-16-2008 05:21 PM

Quote:

Originally Posted by cbkbud (Post 1386169)
Why did we need to bump this? :confused:

I basically said put it in onCreated in the last post.

I'm not known to read well or pay much of an attention at 4AM :D

Admins 04-16-2008 07:49 PM

setPM() in onCreated() doesn't help since onCreated() is not called on server restart (it will call onInitialized()). It's better to call setPM("") in onActionPlayerOnline.

The first line is the "advertising URL", not used for a long time but to stay compatible with scripts that expect to skip the first line it's still inserting an empty line.

bscharff 05-16-2008 03:22 AM

Learn something new every day.

cbk1994 05-16-2008 03:46 AM

Quote:

Originally Posted by bscharff (Post 1390984)
Learn something new every day.

Man, now you're back to bumping threads :rolleyes:


All times are GMT +2. The time now is 04:39 AM.

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