Mootie Posted November 9, 2012 Posted November 9, 2012 zhakastia,104,68,5 script PvP Warper 413, { //PvP Warper mes "[ ^000088PvP Arena Warper^000000 ]"; mes "Would you like to go to the PVP Arena"; next; switch(select("Arena 1 (Dipel)","Abort")) { case 1: warp "guild_vs3",0,0; close; case 2: function script dispell { while ( .@STATUS < 297 ) { if ( .@STATUS != SC_WEIGHT50 && .@STATUS != SC_WEIGHT90 && .@STATUS != SC_NOCHAT && .@STATUS != SC_XMAS && .@STATUS != SC_SUMMER && .@STATUS != SC_JAILED ) sc_end .@STATUS; set .@STATUS, .@STATUS+1; } return; } close; } } Quote
Emistry Posted November 9, 2012 Posted November 9, 2012 http://pastebin.com/raw.php?i=nLZYu9Tj the "dispell" function that can be access by any NPC...because it's declared globally... or http://pastebin.com/raw.php?i=13hhxUdp the "dispell" function that can only be access by this NPC...because it's not declared globally...but declared inside the npc only. Quote
Mootie Posted November 9, 2012 Author Posted November 9, 2012 (edited) http://pastebin.com/raw.php?i=nLZYu9Tj the "dispell" function that can be access by any NPC...because it's declared globally... or http://pastebin.com/raw.php?i=13hhxUdp the "dispell" function that can only be access by this NPC...because it's not declared globally...but declared inside the npc only. thank you for correcting me i was searching for normal refiner like if the weapon/armor is +4 it has chance to be broke Edited November 9, 2012 by Mootie Quote
Ryokem Posted November 9, 2012 Posted November 9, 2012 Just to know, can you really script a function inside a switch case? O.o New feature of rA? xD Quote
Emistry Posted November 9, 2012 Posted November 9, 2012 @Ryokem as you can see inside the script.. the function is defined inside the NPC....thus...it will only work on this npc... and with rAthena improvement... you can simply call a function like this.. // rAthena dispell(); // eAthena callfunc "displell"; you can call the function as long as it's declared somewhere in or outside of the script before it's executed... Quote
Ryokem Posted November 9, 2012 Posted November 9, 2012 @Ryokem as you can see inside the script.. the function is defined inside the NPC....thus...it will only work on this npc... and with rAthena improvement... you can simply call a function like this.. // rAthena dispell(); // eAthena callfunc "displell"; you can call the function as long as it's declared somewhere in or outside of the script before it's executed... Yeh, I know imperative languages pretty well But that was not what I was aking for. function dispell(); //<-- Initialization on dispell function dispell(); //<-- function call What I mean is, can you really define the function script inside another one? <header>,{ function script <name> { //function features } } Does this work on rAthena? If you check on C, C++, Java or similar, each function must be declared not in another one, even if each function can call another one. That was what I was looking at, to learn if it's possible to or it is just a weird error. Quote
Emistry Posted November 9, 2012 Posted November 9, 2012 when you create a function outside a npc....... it will look like this.. if it's inside the npc.....it will look like this... there are different between the funtion's "header" that create in / outside of npc... Quote
Ryokem Posted November 9, 2012 Posted November 9, 2012 when you create a function outside a npc....... it will look like this.. if it's inside the npc.....it will look like this... there are different between the funtion's "header" that create in / outside of npc... Uh, ok I got it, something such as an @override or @overload... I've always said it, there's always something new to learn! Arigatou! Quote
Question
Mootie
7 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.