uDe Posted April 10, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 400 Reputation: 5 Joined: 12/05/11 Last Seen: September 27, 2015 Share Posted April 10, 2012 Sorry for asking this kind of question. Can I use 2x OnWhisperGlobal: funtion in the same script? Quote Link to comment Share on other sites More sharing options...
Brian Posted April 10, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted April 10, 2012 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. Quote Link to comment Share on other sites More sharing options...
uDe Posted April 10, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 400 Reputation: 5 Joined: 12/05/11 Last Seen: September 27, 2015 Author Share Posted April 10, 2012 (edited) 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 April 10, 2012 by uDe Quote Link to comment Share on other sites More sharing options...
Brian Posted April 10, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted April 10, 2012 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". Quote Link to comment Share on other sites More sharing options...
uDe Posted April 10, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 400 Reputation: 5 Joined: 12/05/11 Last Seen: September 27, 2015 Author Share Posted April 10, 2012 I'm a little bit blur.. So, after using ur example, how can I trigger the OnInit: ? Quote Link to comment Share on other sites More sharing options...
QQfoolsorellina Posted April 10, 2012 Group: Members Topic Count: 40 Topics Per Day: 0.01 Content Count: 587 Reputation: 105 Joined: 11/19/11 Last Seen: July 7, 2019 Share Posted April 10, 2012 (edited) - <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 April 10, 2012 by QQfoolsorellina Quote Link to comment Share on other sites More sharing options...
uDe Posted April 10, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 400 Reputation: 5 Joined: 12/05/11 Last Seen: September 27, 2015 Author Share Posted April 10, 2012 (edited) - <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 April 10, 2012 by uDe Quote Link to comment Share on other sites More sharing options...
QQfoolsorellina Posted April 10, 2012 Group: Members Topic Count: 40 Topics Per Day: 0.01 Content Count: 587 Reputation: 105 Joined: 11/19/11 Last Seen: July 7, 2019 Share Posted April 10, 2012 - <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; } Quote Link to comment Share on other sites More sharing options...
uDe Posted April 10, 2012 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 400 Reputation: 5 Joined: 12/05/11 Last Seen: September 27, 2015 Author Share Posted April 10, 2012 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 Quote Link to comment Share on other sites More sharing options...
Question
uDe
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.