Jump to content
  • 0

OnWhisperGlobal:


uDe

Question


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

Sorry for asking this kind of question.

Can I use 2x OnWhisperGlobal: funtion in the same script?

Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

No.

Labels in each NPC object must be unique (this includes your own labels, like L_Menu,

and pre-defined labels like OnWhisperGlobal, OnPCDieEvent, etc).

Could your code be combined into 1 OnWhisperGlobal label in the same NPC?

If they must be separate, then just make 2 NPCs.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

How about if I use this?

- <tab>script<tab>NPCNAME<tab>-1,{
OnWhisperGlobal:
if (@whispervar0$ == "NPC On") callfunc(OnInit);
OnInit:
<Script>
end;
}

The reason of using OnWhisperGlobal: is to trigger OnInit: function because I don't want to use @reloadscript or restart the server. After digging some thread at here, I found that OnInit: function can be trigger by OnWhisperGlobal: after using @loadnpc command.

And I want to add more call function from using OnWhisperGlobal:

Edited by uDe
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

You just put both labels at the beginning of the script,

-	script	NPCNAME	-1,{
OnWhisperGlobal:
OnInit:
// do stuff here

end;
}

then either label will trigger the "do stuff".

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

I'm a little bit blur.. So, after using ur example, how can I trigger the OnInit: ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   105
  • Joined:  11/19/11
  • Last Seen:  

- <tab>script<tab>NPCNAME<tab>-1,{
OnWhisperGlobal:
if (@whispervar0$ != "NPC On")end;
OnInit:
<Script>
end;
}

or other way

http://rathena.org/board/topic/60694-oninit-trigger/

Edited by QQfoolsorellina
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

- <tab>script<tab>NPCNAME<tab>-1,{
OnWhisperGlobal:
if (@whispervar0$ != "NPC On")end;
OnInit:
<Script>
end;
}

or other way

http://rathena.org/b...oninit-trigger/

Looks great..

How to add 1 more call function?

Example :

function TestMenus {

The first one is for trigger the OnInit and then second purpose is to use call/use the another function.

Edited by uDe
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   105
  • Joined:  11/19/11
  • Last Seen:  

- <tab>script<tab>NPCNAME<tab>-1,{
OnWhisperGlobal:
if (@whispervar0$ != "NPC On")end;
set .@whaid,getchaird(3);
OnInit:
if(.@whaid)  callfunc("TestMenus");
<Script>

end;

}

function TestMenus {

<Script>

retrun;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

Thank you for helping me and I've found this and it's working :

OnWhisperGlobal:
if (@whispervar0$ == "On") goto L_Menu; else if (@whispervar0$ == "Off") goto L_Menu2;

Just need some tweak a bit on that..

I don't really mind about

set .@whaid,getchaird(3);

So, I think my problems is solve here. Thanks for help Brian & QQfoolsorellina

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...