Jump to content
  • 0

is this simple script works? im little learning


Mootie

Question


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

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; }
}

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10018
  • Reputation:   2369
  • Joined:  10/28/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  815
  • Reputation:   86
  • Joined:  10/26/12
  • Last Seen:  

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 by Mootie
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Just to know, can you really script a function inside a switch case? O.o

New feature of rA? xD

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10018
  • Reputation:   2369
  • Joined:  10/28/11
  • Last Seen:  

@Ryokem

as you can see inside the script..

zkQHt.png


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...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

@Ryokem

as you can see inside the script..

zkQHt.png


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 :P

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.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10018
  • Reputation:   2369
  • Joined:  10/28/11
  • Last Seen:  

when you create a function outside a npc.......

it will look like this..

N24nz.png

if it's inside the npc.....it will look like this...

QkKlS.png

there are different between the funtion's "header" that create in / outside of npc...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

when you create a function outside a npc.......

it will look like this..

N24nz.png

if it's inside the npc.....it will look like this...

QkKlS.png

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... :D

I've always said it, there's always something new to learn! :) Arigatou!

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...