uDe Posted April 10, 2012 Posted April 10, 2012 Sorry for asking this kind of question. Can I use 2x OnWhisperGlobal: funtion in the same script? Quote
Brian Posted April 10, 2012 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
uDe Posted April 10, 2012 Author 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
Brian Posted April 10, 2012 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
uDe Posted April 10, 2012 Author Posted April 10, 2012 I'm a little bit blur.. So, after using ur example, how can I trigger the OnInit: ? Quote
QQfoolsorellina Posted April 10, 2012 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
uDe Posted April 10, 2012 Author 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
QQfoolsorellina Posted April 10, 2012 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
uDe Posted April 10, 2012 Author 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
Question
uDe
Sorry for asking this kind of question.
Can I use 2x OnWhisperGlobal: funtion in the same script?
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.