MikZ 5 Posted August 23, 2020 Good day! Requesting to convert this to Hercules please.} error found in this line script inarray if(inarray(.blackList[0],.@potion) != -1){ Full script below. thanks! //===== rAthena Script ======================================= //= Auto-Potion //===== Description: ========================================= //= Provides an @autopot command to automatically use potions. //===== Changelogs: ========================================== //= 1.0 First version. [Euphy] //= 2.0 rewrite and adding SP option. [sader1992] //============================================================ - script #autopot -1,{ OnInit: .HP_Option = true; //Allow HP option .SP_Option = true; //Allow SP option .MinDelay = 100; //Minimum Delay Allowed in milliseconds (Default and Recommended: 100) [lower values will increase server strain] setarray .blackList[0],0; //Array of black listed item ID if(!.HP_Option && !.SP_Option){ debugmes "Warning: @autopot both hp and sp are Disabled"; debugmes "Warning: @autopot script has been Disabled!"; end; } bindatcmd("autopot",strnpcinfo(0)+"::OnCommand",0,99); end; L_Help: dispbottom "Available commands:"; if(.HP_Option && .SP_Option){ dispbottom " @autopot <hp|sp> <item id> {<min hp|sp % [1..100]> {<delay [" + .MinDelay + "..1000]>}}"; dispbottom " @autopot <hp|sp> list"; dispbottom " @autopot <hp|sp> <on|off>"; }else{ dispbottom " @autopot <" + (.HP_Option?"hp":"sp") + "> <item id> {<min " + (.HP_Option?"hp":"sp") + " % [1..100]> {<delay [" + .MinDelay + "..1000]>}}"; dispbottom " @autopot <" + (.HP_Option?"hp":"sp") + "> list"; dispbottom " @autopot <" + (.HP_Option?"hp":"sp") + "> <on|off>"; } dispbottom " @autopot info"; dispbottom " @autopot help"; dispbottom " @autopot blacklist"; return; L_Info: dispbottom "----------Auto-Potion Information-----------"; if(.HP_Option){ dispbottom "HP POTION: " + getitemname(@autopot_hp_ID) + " (" + @autopot_hp_ID + ")"; dispbottom "MIN HP: " + @autopot_hp_Min + " %"; } if(.SP_Option){ dispbottom "SP POTION: " + getitemname(@autopot_sp_ID) + " (" + @autopot_sp_ID + ")"; dispbottom "MIN SP: " + @autopot_sp_Min + " %"; } dispbottom "DELAY: " + @autopot_delay + " ms"; dispbottom "---------------------------------------------"; return; L_Start: deltimer strnpcinfo(3) + "::OnStart"; .@type$ = getarg(0,0); .@potion = getarg(1,0); setd "@autopot_" + .@type$ + "_Min",getarg(2,0); @autopot_delay = getarg(3,0); if (getd("@autopot_" + .@type$ + "_Min") < 1 || getd("@autopot_" + .@type$ + "_Min") > 100) setd "@autopot_" + .@type$ + "_Min",90; if (@autopot_delay < 50 || @autopot_delay > 1000) @autopot_delay = .MinDelay; if (getiteminfo(.@potion,2) != IT_HEALING) { dispbottom getitemname(.@potion) + " is not a healing item."; end; } if(inarray(.blackList[0],.@potion) != -1){ message strcharinfo(0), "'" + getitemname(.@potion) + "' is black listed and cannot be used."; end; } if (BaseLevel < getiteminfo(.@potion,12)) { message strcharinfo(0), "Your base level is too low to use '" + getitemname(.@potion) + "'."; end; } setd "@autopot_" + .@type$ + "_ID",.@potion; setd "@autopot_" + .@type$ + "_Active",true; addtimer .@delay,strnpcinfo(3) + "::OnStart"; message strcharinfo(0), "Auto-Potion " + strtoupper(.@type$) + " enabled."; callsub L_Info; return; OnCommand: if (!getarraysize(.@atcmd_parameters$)) { message strcharinfo(0), "Invalid syntax."; callsub L_Help; end; } .@command$[0] = strtolower(.@atcmd_parameters$[0]); .@command$[1] = strtolower(.@atcmd_parameters$[1]); if(.@command$[0] == "hp" || .@command$[0] == "sp"){ if((!.HP_Option && .@command$[0] == "hp") || (!.SP_Option && .@command$[0] == "sp")){ message strcharinfo(0), "Auto-Potion " + strtoupper(.@command$[0]) + " is Disabled from The Server."; end; } if(.@command$[1] == "on"){ if(getd("@autopot_" + .@command$[0] + "_Active")){ message strcharinfo(0), "Auto-Potion " + strtoupper(.@command$[0]) + " is already on."; end; } if(!getd("@autopot_" + .@command$[0] + "_ID")){ dispbottom "You need to set a " + strtoupper(.@command$[0]) + " Potion to be used."; callsub L_Help; end; } callsub L_Start,.@command$[0],getd("@autopot_" + .@command$[0] + "_ID"); end; } if(.@command$[1] == "off"){ message strcharinfo(0), "Auto-Potion " + strtoupper(.@command$[0]) + " disabled."; setd "@autopot_" + .@command$[0] + "_Active",false; if(!@autopot_hp_Active || !@autopot_sp_Active) deltimer strnpcinfo(3) + "::OnStart"; end; } if(.@command$[1] == "list"){ getinventorylist; for(.@i = 0;.@i < @inventorylist_count;.@i++){ if (getiteminfo(@inventorylist_id[.@i],2) == IT_HEALING) { .@items[.@count] = @inventorylist_id[.@i]; .@menu$ = .@menu$ + sprintf("~ ^0055FF%s^000000 (%dx)" + (inarray(.blackList[0],@inventorylist_id[.@i]) != -1? " ^364022Black Listed^000000":"") + (BaseLevel < getiteminfo(@inventorylist_id[.@i],12)? " ^E82C0CNeed Higher Level^000000":"") + ":", getitemname(@inventorylist_id[.@i]), countitem(@inventorylist_id[.@i])); .@count++; } } if(.@count){ mes "[ Auto-Potion ]"; mes "Select a " + strtoupper(.@command$[0]) + " item."; .@select = select(.@menu$ + " ^777777Cancel^000000") - 1; if (.@select != .@count) callsub L_Start,.@command$[0],.@items[.@select]; close2; }else{ message strcharinfo(0), "There are no healing items in your inventory."; } end; } .@potion = atoi(.@command$[1]); .@percent = atoi(.@atcmd_parameters$[2]); .@delay = atoi(.@atcmd_parameters$[3]); if(getitemname(.@potion) != "null"){ callsub L_Start,.@command$[0],.@potion,.@percent,.@delay; end; } message strcharinfo(0), "Auto-Potion : something went wrong!"; callsub L_Help; end; } if(.@command$[0] == "blacklist"){ dispbottom "--------------Black Listed Items--------------"; for(.@i=0;.@i<getarraysize(.blackList);.@i++){ dispbottom " " + getitemname(.blackList[.@i]) + " (" + .blackList[.@i] + ")"; } dispbottom "---------------------------------------------"; end; } if(.@command$[0] == "info"){ if(@autopot_hp_Active || @autopot_sp_Active){ message strcharinfo(0), "Auto-Potion information is displayed below."; callsub L_Info; }else{ message strcharinfo(0), "Auto-Potion is not enabled."; } end; } if(.@command$[0] == "help"){ message strcharinfo(0), "List of commands is displayed below."; callsub L_Help; end; } message strcharinfo(0), "Invalid syntax."; callsub L_Help; end; OnStart: if (!getstatus(SC_BERSERK) && !getstatus(SC_SATURDAYNIGHTFEVER) && !getstatus(SC_GRAVITATION) && !getstatus(SC_TRICKDEAD) && !getstatus(SC_HIDING) && !getstatus(SC__SHADOWFORM) && !getstatus(SC__INVISIBILITY) && !getstatus(SC__MANHOLE) && !getstatus(SC_KAGEHUMI) && !getstatus(SC_HEAT_BARREL_AFTER) && !getstatus(SC_STONE) && !getstatus(SC_FREEZE) && !getstatus(SC_STUN) && !getstatus(SC_SLEEP)) { if(Hp){ if(@autopot_hp_Active && Hp * 100 / MaxHp < @autopot_hp_Min) { if (countitem(@autopot_hp_ID)) { delitem @autopot_hp_ID,1; consumeitem @autopot_hp_ID; specialeffect2 207; } } if(@autopot_sp_Active && Sp * 100 / MaxSp < @autopot_sp_Min) { if (countitem(@autopot_sp_ID)) { delitem @autopot_sp_ID,1; consumeitem @autopot_sp_ID; specialeffect2 208; } } } } if(@autopot_hp_Active || @autopot_sp_Active) addtimer @autopot_delay,strnpcinfo(3) + "::OnStart"; end; } Quote Share this post Link to post Share on other sites
0 meko 170 Posted August 23, 2020 for inarray() you can use array_find() from Array manipulation functions, which behaves the same way: if (array_find(.blackList[0], .@potion) != -1) { for debugmes you should use consolemes: consolemes(CONSOLEMES_DEBUG, "message"); 1 MikZ reacted to this Quote Share this post Link to post Share on other sites
0 MikZ 5 Posted August 24, 2020 10 hours ago, meko said: for inarray() you can use array_find() from Array manipulation functions, which behaves the same way: if (array_find(.blackList[0], .@potion) != -1) { if (array_find(.blackList[0], .@potion) != -1) { Hi @meko Good day! I did check in https://haru.ws/scriptchecker/#output and got this error. Haven't tried in my server yet. Quote Share this post Link to post Share on other sites
0 Samuel 83 Posted August 24, 2020 10 hours ago, MikZ said: Hi @meko Good day! I did check in https://haru.ws/scriptchecker/#output and got this error. Haven't tried in my server yet. Did you include the array_find function? It's a custom function so you need to copy the function script and include it either inside the script or any script that will make the function load. 1 MikZ reacted to this Quote Share this post Link to post Share on other sites
0 MikZ 5 Posted August 24, 2020 (edited) 19 minutes ago, Samuel said: Did you include the array_find function? It's a custom function so you need to copy the function script and include it either inside the script or any script that will make the function load. Hi Samuel, I see. wait let me try. Edited August 24, 2020 by MikZ Quote Share this post Link to post Share on other sites
0 MikZ 5 Posted August 24, 2020 Sweet! Thank you so much! Quote Share this post Link to post Share on other sites
0 Astronom 0 Posted October 22, 2020 On 8/24/2020 at 5:31 PM, MikZ said: Sweet! Thank you so much! Hi, help, how did you fix the script? Quote Share this post Link to post Share on other sites
0 MikZ 5 Posted November 14, 2020 On 10/22/2020 at 11:47 PM, Astronom said: Hi, help, how did you fix the script? simply add the array_find and the array_find script from here Quote Share this post Link to post Share on other sites
0 Eross 0 Posted May 21, 2021 On 8/23/2020 at 8:43 PM, MikZ said: Hi @meko Good day! I did check in https://haru.ws/scriptchecker/#output and got this error. Haven't tried in my server yet. Sorry to bring this thread up again ,, Its the only topic that matched my problem .. I tried this one changing to array_find and loading the manipulation script but still the same ... heres my script - script warp_block -1,{ OnInit: bindatcmd "warp",strnpcinfo(3)+"::OnAtcommandWarp",20,99; bindatcmd "recall",strnpcinfo(3)+"::OnAtcommandRecall",20,99; //setarray .maps_from$[0], "guild_01", "guild_02"; // Maps they cannot warp from. setarray .maps$[0], // Maps they cannot warp to. "gld2_pay", // GLD DUNGEON "gld_dun01_2", // GLD DUNGEON "gld_dun01", // GLD DUNGEON "gld2_ald", // GLD DUNGEON "gld_dun02_2", // GLD DUNGEON "gld_dun02", // GLD DUNGEON "gld2_prt", // GLD DUNGEON "gld_dun03_2", // GLD DUNGEON "gld_dun03", // GLD DUNGEON "gld2_gef", // GLD DUNGEON "gld_dun04_2", // GLD DUNGEON "gld_dun04", // GLD DUNGEON "schg_dun01", // GLD DUNGEON "teg_dun01", // GLD DUNGEON "teg_dun02", // GLD DUNGEON "odin_tem01", "odin_tem02", "rachel", "lighthalzen", "lhz_dun01", "lhz_dun02", "lhz_dun03", "hugel", "veins", "ve_fild01", "ve_fild02", "ve_fild03", "thor_v01", "thor_v02", "thor_v03", "moc_pryd06", "ra_fild02", "ra_fild03", "ra_fild04", "lou_dun03", "prt_maze03", "bra_dun02", "splendide", "manuk", "man_fild02", "dic_fild01", "dic_fild02", "spl_fild01", "spl_fild02", "spl_fild03", "moc_fild22", "moc_fild21", "gl_chyard", "abyss_03", "gef_dun02", "treasure02", "pay_fild11", "gon_dun03", "abbey02", "abbey03", "xmas_fild01", "ra_san05", "prt_sewb4", "mosk_dun03", "ama_dun03", "kh_dun02", "xmas_dun02", "ice_dun03", "ice_dun02", "ice_dun01", "ayo_dun02", "niflheim", "anthell02", "mjolnir_04", "pay_dun04", "2@nyd", "moc_prydn2", "gef_fild02", "gef_fild14", "gef_fild10", "moc_pryd04", "in_sphinx5", "moc_fild17", "ein_dun02", "einbroch", "beach_dun", "thana_boss", "tur_dun04", "jupe_core", "nameless_n", "1@tower", "2@tower", "3@tower", "4@tower", "5@tower", "6@tower", "payon"; end; OnAtcommandWarp: if (getgmlevel() == 99 ) goto Bypass_Script_Warp; if(array_find(.maps$[0], strcharinfo(3))>-1) { message strcharinfo(0), "You can't open use warp here!"; end; } else if (inarray(.maps$[0], .@atcmd_parameters$)>-1) { message strcharinfo(0), "You can't warp to that map!"; end; } Bypass_Script_Warp: if(.@atcmd_numparameters) atcommand "@warp "+ implode(.@atcmd_parameters$, " "); else atcommand "@warp"; end; OnAtcommandRecall: if(inarray(.maps$[0], strcharinfo(3))>-1) { message strcharinfo(0), "You can't use recall here!"; end; } if(.@atcmd_numparameters) atcommand "@recall "+ implode(.@atcmd_parameters$, " "); else atcommand "@recall"; end; } Quote Share this post Link to post Share on other sites
0 Samuel 83 Posted May 21, 2021 8 hours ago, Origami said: Sorry to bring this thread up again ,, Its the only topic that matched my problem .. I tried this one changing to array_find and loading the manipulation script but still the same ... heres my script - script warp_block -1,{ OnInit: bindatcmd "warp",strnpcinfo(3)+"::OnAtcommandWarp",20,99; bindatcmd "recall",strnpcinfo(3)+"::OnAtcommandRecall",20,99; //setarray .maps_from$[0], "guild_01", "guild_02"; // Maps they cannot warp from. setarray .maps$[0], // Maps they cannot warp to. "gld2_pay", // GLD DUNGEON "gld_dun01_2", // GLD DUNGEON "gld_dun01", // GLD DUNGEON "gld2_ald", // GLD DUNGEON "gld_dun02_2", // GLD DUNGEON "gld_dun02", // GLD DUNGEON "gld2_prt", // GLD DUNGEON "gld_dun03_2", // GLD DUNGEON "gld_dun03", // GLD DUNGEON "gld2_gef", // GLD DUNGEON "gld_dun04_2", // GLD DUNGEON "gld_dun04", // GLD DUNGEON "schg_dun01", // GLD DUNGEON "teg_dun01", // GLD DUNGEON "teg_dun02", // GLD DUNGEON "odin_tem01", "odin_tem02", "rachel", "lighthalzen", "lhz_dun01", "lhz_dun02", "lhz_dun03", "hugel", "veins", "ve_fild01", "ve_fild02", "ve_fild03", "thor_v01", "thor_v02", "thor_v03", "moc_pryd06", "ra_fild02", "ra_fild03", "ra_fild04", "lou_dun03", "prt_maze03", "bra_dun02", "splendide", "manuk", "man_fild02", "dic_fild01", "dic_fild02", "spl_fild01", "spl_fild02", "spl_fild03", "moc_fild22", "moc_fild21", "gl_chyard", "abyss_03", "gef_dun02", "treasure02", "pay_fild11", "gon_dun03", "abbey02", "abbey03", "xmas_fild01", "ra_san05", "prt_sewb4", "mosk_dun03", "ama_dun03", "kh_dun02", "xmas_dun02", "ice_dun03", "ice_dun02", "ice_dun01", "ayo_dun02", "niflheim", "anthell02", "mjolnir_04", "pay_dun04", "2@nyd", "moc_prydn2", "gef_fild02", "gef_fild14", "gef_fild10", "moc_pryd04", "in_sphinx5", "moc_fild17", "ein_dun02", "einbroch", "beach_dun", "thana_boss", "tur_dun04", "jupe_core", "nameless_n", "1@tower", "2@tower", "3@tower", "4@tower", "5@tower", "6@tower", "payon"; end; OnAtcommandWarp: if (getgmlevel() == 99 ) goto Bypass_Script_Warp; if(array_find(.maps$[0], strcharinfo(3))>-1) { message strcharinfo(0), "You can't open use warp here!"; end; } else if (inarray(.maps$[0], .@atcmd_parameters$)>-1) { message strcharinfo(0), "You can't warp to that map!"; end; } Bypass_Script_Warp: if(.@atcmd_numparameters) atcommand "@warp "+ implode(.@atcmd_parameters$, " "); else atcommand "@warp"; end; OnAtcommandRecall: if(inarray(.maps$[0], strcharinfo(3))>-1) { message strcharinfo(0), "You can't use recall here!"; end; } if(.@atcmd_numparameters) atcommand "@recall "+ implode(.@atcmd_parameters$, " "); else atcommand "@recall"; end; } - script warp_block -1,{ OnInit: bindatcmd "warp",strnpcinfo(3)+"::OnAtcommandWarp",20,99; bindatcmd "recall",strnpcinfo(3)+"::OnAtcommandRecall",20,99; //setarray .maps_from$[0], "guild_01", "guild_02"; // Maps they cannot warp from. setarray .maps$[0], // Maps they cannot warp to. "gld2_pay", // GLD DUNGEON "gld_dun01_2", // GLD DUNGEON "gld_dun01", // GLD DUNGEON "gld2_ald", // GLD DUNGEON "gld_dun02_2", // GLD DUNGEON "gld_dun02", // GLD DUNGEON "gld2_prt", // GLD DUNGEON "gld_dun03_2", // GLD DUNGEON "gld_dun03", // GLD DUNGEON "gld2_gef", // GLD DUNGEON "gld_dun04_2", // GLD DUNGEON "gld_dun04", // GLD DUNGEON "schg_dun01", // GLD DUNGEON "teg_dun01", // GLD DUNGEON "teg_dun02", // GLD DUNGEON "odin_tem01", "odin_tem02", "rachel", "lighthalzen", "lhz_dun01", "lhz_dun02", "lhz_dun03", "hugel", "veins", "ve_fild01", "ve_fild02", "ve_fild03", "thor_v01", "thor_v02", "thor_v03", "moc_pryd06", "ra_fild02", "ra_fild03", "ra_fild04", "lou_dun03", "prt_maze03", "bra_dun02", "splendide", "manuk", "man_fild02", "dic_fild01", "dic_fild02", "spl_fild01", "spl_fild02", "spl_fild03", "moc_fild22", "moc_fild21", "gl_chyard", "abyss_03", "gef_dun02", "treasure02", "pay_fild11", "gon_dun03", "abbey02", "abbey03", "xmas_fild01", "ra_san05", "prt_sewb4", "mosk_dun03", "ama_dun03", "kh_dun02", "xmas_dun02", "ice_dun03", "ice_dun02", "ice_dun01", "ayo_dun02", "niflheim", "anthell02", "mjolnir_04", "pay_dun04", "2@nyd", "moc_prydn2", "gef_fild02", "gef_fild14", "gef_fild10", "moc_pryd04", "in_sphinx5", "moc_fild17", "ein_dun02", "einbroch", "beach_dun", "thana_boss", "tur_dun04", "jupe_core", "nameless_n", "1@tower", "2@tower", "3@tower", "4@tower", "5@tower", "6@tower", "payon"; end; OnAtcommandWarp: if (getgmlevel() == 99 ) goto Bypass_Script_Warp; if(array_find(.maps$[0], strcharinfo(3))>-1) { message strcharinfo(0), "You can't open use warp here!"; end; } else if (inarray(.maps$[0], .@atcmd_parameters$)>-1) { message strcharinfo(0), "You can't warp to that map!"; end; } Bypass_Script_Warp: if(.@atcmd_numparameters) atcommand "@warp "+ implode(.@atcmd_parameters$, " "); else atcommand "@warp"; end; OnAtcommandRecall: if(inarray(.maps$[0], strcharinfo(3))>-1) { message strcharinfo(0), "You can't use recall here!"; end; } if(.@atcmd_numparameters) atcommand "@recall "+ implode(.@atcmd_parameters$, " "); else atcommand "@recall"; end; } The array functions should load first before your script or they will not be recognized as function. Try to paste the functions above your script. Quote Share this post Link to post Share on other sites
Good day!
Requesting to convert this to Hercules please.}
error found in this line script inarray
if(inarray(.blackList[0],.@potion) != -1){
Full script below. thanks!
Share this post
Link to post
Share on other sites