Jump to content

Common Useful Function


yuchinin

Recommended Posts


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  120
  • Reputation:   48
  • Joined:  07/23/13
  • Last Seen:  

//===== rAthena Script =======================================
//= Common Useful Function
//===== By: ==================================================
//= Yuchinin
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
//= rAthena Project
//===== Description: =========================================
//= A common useful function I wrote these few years.
//= Hoping with these can help other to write useful script.
//=====******** Note ********=================================
//= This will be the core of my other script.
//= Better let it load first before adding my other script.
//===== Additional Comments: =================================
//= 1.0 Initial script.
//= 1.1 Change function arrdel from using 'value' to 'index'
//= 1.2 Fixed sql query bug
//============================================================
 

Function List:

//===================================
//= walktonpc({<unitid>,<distance>})
//= walk character in npc <distance>
//===================================


//===================================
//= npcindistance(<distance>)
//= check if distance with npc smaller or equal to <distance>
//= return to the caller
//= else walk in npc <distance> 
//===================================


//===================================
//= getVariable(<"npc variable name">,{"<owner>"})
//= return variable value
//= owner will be calling npc if omitted
//===================================


//===================================
//= setVariable(<"npc variable name">,{<"owner">})
//= set variable value
//= owner will be calling npc if omitted
//===================================


//===================================
//= arradd("<arrayname>",<value>,{<"owner">})
//= add value to array
//= owner will be calling npc if omitted
//===================================


//===================================
//= arrdel("<arrayname>",<index>,{<"owner">})
//= delete index from array
//= owner will be calling npc if omitted
//===================================


//===================================
// arrhas("<arrayname>",<value>,{<"owner">})
//= check if value in array
//= return 1 if in else return 0
//===================================


//===================================
// arrfind("<arrayname>",<value>,{<"owner">})
//= return first found value index in array
//= return -1 if not found
//===================================


//===================================
// arrselect("<arrayname>",{<"label">,"<owner>"})
//= return selected array value after selection
//= label add before selection 
//= owner will be calling npc if omitted
//===================================


//==============================
//= UpperFirst("<string>")
//= return string with first string capital
//==============================


//=========================================
//= getRemain(<sec>)
//= return remaining time string
//=========================================


//=========================================
//= CStr(<"string to change color">,{<"color name">})
//= return string with selected color
//=========================================


//=========================================
//= CZeny(<zeny>,{<"delimiter">,<"symbol">})
//= return ease look zeny string
//=========================================


//=========================================
//= Itemlink(<itemid>)
//= return item string with itemlink added
//=========================================


// Below is custom inventory system for npc


//===================================
//= invcount("<owner>")
//= return inventory count
//===================================


//===================================
//= invcountitem(<itemid>,"<owner>")
//= return item count in inventory
//===================================


//===================================
//= invselect("<owner>","<blacklistid>","<label>")
//= add label before selection
//= return itemid after selection
//===================================


//===================================
//= invgetitem(<itemid>,"<owner>",{<amount>})
//= return itemid if success
//= return 0 if fail
//===================================


//===================================
//= invhasitem(<itemid>,"<owner>")
//= return itemid if have item
//= return 0 if don't have item
//===================================


//===================================
//= invdelitem(<itemid>,"<owner>",{<amount>})
//= return itemid if success
//= return 0 if fail
//===================================


//===================================
//= invclear("<owner>")
//= clear all inventory
//===================================
 
download:
 
Git:
Edited by yuchinin
  • Upvote 2
Link to comment
Share on other sites

  • 1 year later...

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  3
  • Reputation:   0
  • Joined:  09/22/17
  • Last Seen:  

Excuseme! But i'm a newbie. Could you tell me  how to use this function? Ex: Where will i locate it? Which files i have to modified to enable this script?

 

Best regards!

 

Edited by rainkaj
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

1 hour ago, rainkaj said:

Excuseme! But i'm a newbie. Could you tell me  how to use this function? Ex: Where will i locate it? Which files i have to modified to enable this script?

 

Best regards!

 

You just need to add this script as every other NPC script, this functions are used in yuchins other scripts, to use those scripts you must have this function loaded

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  3
  • Reputation:   0
  • Joined:  09/22/17
  • Last Seen:  

thanks you very much!

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
Reply to this topic...

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