summaryrefslogtreecommitdiff
path: root/npc/other/Global_Functions.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/other/Global_Functions.txt')
-rw-r--r--npc/other/Global_Functions.txt186
1 files changed, 75 insertions, 111 deletions
diff --git a/npc/other/Global_Functions.txt b/npc/other/Global_Functions.txt
index 6febe2dff..aef48a489 100644
--- a/npc/other/Global_Functions.txt
+++ b/npc/other/Global_Functions.txt
@@ -1,57 +1,53 @@
-//===== Hercules Script ======================================
+//================= Hercules Script =======================================
+//= _ _ _
+//= | | | | | |
+//= | |_| | ___ _ __ ___ _ _| | ___ ___
+//= | _ |/ _ \ '__/ __| | | | |/ _ \/ __|
+//= | | | | __/ | | (__| |_| | | __/\__ \
+//= \_| |_/\___|_| \___|\__,_|_|\___||___/
+//================= License ===============================================
+//= This file is part of Hercules.
+//= http://herc.ws - http://github.com/HerculesWS/Hercules
+//=
+//= Copyright (C) 2012-2015 Hercules Dev Team
+//= Copyright (C) AnnieRuru
+//= Copyright (C) Emistry
+//= Copyright (C) Euphy
+//= Copyright (C) Paradox924X
+//= Copyright (C) L0ne_W0lf
+//= Copyright (C) Evera
+//= Copyright (C) kobra_k88
+//= Copyright (C) Lupus
+//=
+//= Hercules is free software: you can redistribute it and/or modify
+//= it under the terms of the GNU General Public License as published by
+//= the Free Software Foundation, either version 3 of the License, or
+//= (at your option) any later version.
+//=
+//= This program is distributed in the hope that it will be useful,
+//= but WITHOUT ANY WARRANTY; without even the implied warranty of
+//= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//= GNU General Public License for more details.
+//=
+//= You should have received a copy of the GNU General Public License
+//= along with this program. If not, see <http://www.gnu.org/licenses/>.
+//=========================================================================
//= Global Functions
-//===== By: ==================================================
-//= Lupus, kobra_k88
-//===== Current Version: =====================================
-//= 2.18
-//===== Description: =========================================
+//================= Description ===========================================
//= General script functions.
-//===== Additional Comments: =================================
-//= Added F_ClearJobVar - on getting a new job it clears all Job Quest variables
-//= Removed individual job check functions as they were redundant [kobra_k88]
-//= 1.3 Added Job Change Function for Baby/Normal Classes
-//= 1.3b a fix, due to const.txt change [Lupus]
-//= 1.4 Added Is_Taekwon_Class: Taekwondo, Star Knight(Gladiator),Soul Linker [Lupus]
-//= 1.5 Added clear of Bard Quest variables. 1.5a updated [Lupus]
-//= 1.6 Added F_RandMes, F_SexMes, F_Hi, F_Bye functions [Lupus]
-//= Moved here useful function 'getJobName'
-//= 1.7 Added "F_ItemName" function, added a great sample for "F_ItemName"
-//= 1.8 Added Job Vars clear for Extended classes: TK,SL,SG [Lupus]
-//= 1.9 Added "F_ClearGarbage" func that clears outdated, wasted variables [Lupus]
-//= 1.91 Added "F_SaveQuestSkills","F_Load?Skills" functions [Lupus]
-//= 2.0 Fixed F_Save/LoadQuestSkills functions. Had to split in into 2 vars [Lupus]
-//= 2.01 Added $talk to F_ClearGarbage [Evera]
-//= 2.02 Added $dtsglobalelig and $dts|(1<<6) to F_ClearGarbage [Evera]
-//= 2.03 Added Gunslinger vars to F_ClearJobVar [Lupus]
-//= 2.04 Added dtseligible 2 (becomes MISC_QUEST|128) to F_ClearGarbage [Evera]
-//= 2.05 Book of Devil -> MISC_QUEST|256, clear other Niflheim garbage vars [Lupus]
-//= +more garbage clean
-//= 2.06 Pass to Bio-Lab -> MISC_QUEST|512 [Lupus]
-//= 2.07 Added TK_Q variable clear. 2.08 Added NINJ_Q variable clear [Lupus]
-//= 2.09 Cleared F_ClearGarbage [Lupus]
-//= 2.10 Added F_CheckMaxCount to check count of carrid items. [L0ne_w0lf]
-//= 2.10a Removed function F_CheckMaxCount. Not needed. [L0ne_W0lf]
-//= 2.11 Updated function Job_Change to jobchange based on Upper value. [Paradox924X]
-//= 2.12 Added more unused vars to F_ClearGarbage [Lupus]
-//= 2.13 Added more unused vars to F_ClearGarbage [Lupus]
-//= 2.14 Added old novice variables to F_ClearGarbage. [L0ne_W0lf]
-//= 2.15 Added no unused DTS variables to F_ClearGarbage. [L0ne_W0lf]
-//= 2.16 Added F_GetWeaponType, and F_GetArmorType. [L0ne_W0lf]
-//= 2.17 Renamed 'F_RandMes' to 'F_Rand'. [Euphy]
-//= 2.18 Removed useless 'getJobName' function. [Euphy]
-//= 2.19 Improved 'F_InsertComma' function. [Emistry]
-//= 2.20 Add 'F_ShuffleNumbers' function. [AnnieRuru]
-//============================================================
-
-//////////////////////////////////////////////////////////////////////////////////
-// Returns a number with commas based on precision of digits and custom separator.
-// -- callfunc "F_InsertComma",<number>{,<precision>,<separator>}
+//================= Current Version =======================================
+//= 2.20
+//=========================================================================
+
+//== Function F_InsertComma ================================
+// Returns a number with commas based on precision of digits and custom
+// separator.
+// callfunc "F_InsertComma",<number>{,<precision>,<separator>}
// Examples:
// callfunc("F_InsertComma",7777777) // returns "7,777,777"
-// callfunc("F_InsertComma",1000000000,3,",") // returns "1,000,000,000"
-// callfunc("F_InsertComma",1000000000,3,"_") // returns "1_000_000_000"
+// callfunc("F_InsertComma",1000000000,3,","}) // returns "1,000,000,000"
+// callfunc("F_InsertComma",1000000000,3,"_"}) // returns "1_000_000_000"
// callfunc("F_InsertComma",1000000000,4) // returns "10,0000,0000"
-//////////////////////////////////////////////////////////////////////////////////
function script F_InsertComma {
.@value = getarg(0);
.@precision = getarg(1,3);
@@ -68,10 +64,8 @@ function script F_InsertComma {
return .@str$;
}
-//////////////////////////////////////////////////////////////////////////////////
-// Function that clears job quest variables
-//////////////////////////////////////////////////////////////////////////////////
-
+//== Function F_ClearJobVar ================================
+// Clears job quest variables
function script F_ClearJobVar {
// Misc ---------------------------------
JBLVL = 0;
@@ -146,75 +140,50 @@ function script F_ClearGarbage {
return;
}
-//////////////////////////////////////////////////////////////////////////////////
+//== Function Job_Change ===================================
// Used in REBIRTH scripts
-// Class = Internal Class ID
-// BaseJob = Base Job (0..23)
-// Upper : 0 - Default, 1 - Advanced, 2 - Baby
-//////////////////////////////////////////////////////////////////////////////////
-
function script Job_Change {
jobchange getarg(0),Upper; //Jobchange based on Upper
logmes "CLASS CHANGE: " +strcharinfo(0)+ " become a "+jobname(Class);
return;
}
-//////////////////////////////////////////////////////////////////////////////////
-// Functions used to spiff up dialoges [Lupus]
-//////////////////////////////////////////////////////////////////////////////////
-
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Rand"
-//////////////////////////////////////////////////////////////////////////////////
-//returns random argument
-// Example: check F_Bye or F_Hi functions
-// READ AND THINK: You can use it to pick a random number from a list:
-// @itemIDfromList = callfunc("F_Rand",1129,1222,1163,1357,1360,1522,1811,1410);
-
+//== Function F_Rand =======================================
+// Returns a random argument
+// Example: (see also F_Bye or F_Hi functions)
+// .@itemIDfromList = callfunc("F_Rand",1129,1222,1163,1357,1360,1522,1811,1410);
function script F_Rand {
return getarg(rand(getargcount()));
}
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Sex"
-//////////////////////////////////////////////////////////////////////////////////
-//returns 1st argument if female, 2nd argument otherwise
+//== Function F_Sex ========================================
+// Returns 1st argument if female, 2nd argument otherwise
// Example: mes callfunc("F_Sex","What a beautiful lady!","What a handsome man!");
-
function script F_SexMes {
return getarg(Sex);
}
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Hi"
-//////////////////////////////////////////////////////////////////////////////////
-//returns random HELLO message
-
+//== Function F_Hi =========================================
+// Returns random HELLO message
function script F_Hi {
return callfunc("F_Rand","Hi!","Hello!","Good day!","How are you?","Hello there.");
}
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Bye"
-//////////////////////////////////////////////////////////////////////////////////
-//returns random BYE message
-
+//== Function F_Bye ========================================
+// Returns random BYE message
function script F_Bye {
return callfunc("F_Rand","Bye. See you again.","Later.","Goodbye.","Good luck!","Have a nice day!","Byebye!!!");
}
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_ItemName"
-//////////////////////////////////////////////////////////////////////////////////
+//== Function F_ItemName ===================================
// Returns expanded item name string
-//Argumentss
-// 0 - Item ID
-// 1 - Element N (0=none,1=Ice,2=Earth,3=Fire,4=Wind)
-// 2 - VVS meter 0...3
-// 3 - Refine
+// Arguments:
+// - 0 - Item ID
+// - 1 - Element N (0=none,1=Ice,2=Earth,3=Fire,4=Wind)
+// - 2 - VVS meter 0...3
+// - 3 - Refine
// Example: mes "Show me your "+callfunc("F_ItemName",1201,1,2,5)+"...";
// is equal to: mes "Show me your ^000090 +5 VVS Fire Knife ^000000..."
-
function script F_ItemName {
if(getarg(3))
.@t$ += "+"+getarg(3)+" ";
@@ -235,9 +204,8 @@ function script F_ItemName {
return "^000090"+.@t$+getitemname(getarg(0))+"^000000";
}
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_SaveQuestSkills": Store learnt quest skills
-//////////////////////////////////////////////////////////////////////////////////
+//== Function F_SaveQuestSkills ============================
+// Stores learned quest skills
function script F_SaveQuestSkills {
ADV_QSK = 0; ADV_QSK2 = 0;
//1st classes quest skills
@@ -251,9 +219,8 @@ function script F_SaveQuestSkills {
return;
}
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Load1Skills": Restore learnt 1st class quest skills
-//////////////////////////////////////////////////////////////////////////////////
+//== Function F_Load1Skills ================================
+// Restores learned 1st class quest skills
function script F_Load1Skills {
//1st classes quest skills
for(.@i = 0; .@i < 14; ++.@i) {
@@ -263,9 +230,8 @@ function script F_Load1Skills {
return;
}
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_Load2Skills": Restore learnt 2nd class quest skills
-//////////////////////////////////////////////////////////////////////////////////
+//== Function F_Load2Skills ================================
+// Restores learned 2nd class quest skills
function script F_Load2Skills {
//2nd classes quest skills
for (.@i = 0; .@i < 19; ++.@i) {
@@ -275,9 +241,8 @@ function script F_Load2Skills {
return;
}
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_GetWeaponType": Determine weapon type by view
-//////////////////////////////////////////////////////////////////////////////////
+//== Function F_GetWeaponType ==============================
+// Determines weapon type by view
function script F_GetWeaponType {
switch(getiteminfo(getarg(0),11)) {
case 1: return "Dagger"; break;
@@ -307,9 +272,8 @@ function script F_GetWeaponType {
end;
}
-//////////////////////////////////////////////////////////////////////////////////
-// *** Function "F_GetArmorType": Determine equipment type by equip location
-//////////////////////////////////////////////////////////////////////////////////
+//== Function F_GetArmorType ===============================
+// Determines equipment type by equip location
function script F_GetArmorType {
switch(getiteminfo(getarg(0),5)) {
case 001: return "Lower Headgear"; break;
@@ -327,8 +291,8 @@ function script F_GetArmorType {
end;
}
+//== Function Time2Str =====================================
// Time calculation Function
-// *********************************************************************
function script Time2Str {
.@time_left = getarg(0) - gettimetick(2);