Skorm Posted August 5, 2014 Posted August 5, 2014 View File Selection Buffer This is just a buffer NPC that I made for someone in the script request section. It's pretty versatile and sturdy so instead of it being depreciated I thought others might use it. Description: Select from a list of buffs the ones you want to purchase each time you buff. Double click to reselect buffs. Everything is stored in one character variable. ( preview slowed to increase loading times ) Submitter Skorm Submitted 08/05/14 Category Utilities Video Content Author Skorm 1 1 Quote
Pneuma Posted August 5, 2014 Posted August 5, 2014 What's to stop people from Warping upon getting the buff and not having to pay? Quote
Skorm Posted August 6, 2014 Author Posted August 6, 2014 What's to stop people from Warping upon getting the buff and not having to pay? That's just the buff selection window... You don't pay anything there. You just select the buffs you'd like to purchase when clicking the npc. The buffs and money are taken with one click, in other words that isn't a problem. Perfect idea.. ^ ^ Keep it up sir Thanks I'm glad you like it although the idea isn't entirely mine. Original idea here http://rathena.org/board/topic/96963-custom-buffer/ Quote
Checkmate Posted August 6, 2014 Posted August 6, 2014 CheckMate, on 06 Aug 2014 - 09:57 AM, said: Perfect idea.. ^ ^ Keep it up sir Thanks I'm glad you like it although the idea isn't entirely mine. Original idea here http://rathena.org/b...-custom-buffer/ Ooo.. But it ok sir.... Since you can elaborate the script to be more perfect and share it.. That a nice in you... I wish i can be scripter like you too... /sigh Quote
Currently Posted August 9, 2014 Posted August 9, 2014 prontera,158,156,4 script Pay for Buff 100,{ if( @h_last > gettimetick(2) || !slc_bufs ) goto Set_Buffs; set @h_last, gettimetick(2)+5; .@total = callsub(Sub_PriceCheck); if( .@total > Zeny ) { message strcharinfo(0), "You don't have enough zeny to buff double click the buffer to modify your selection."; end; } for( .@a = 0; .@a < .len; .@a++ ) if( ( slc_bufs & pow( 2, .@a ) ) ) { skilleffect .skil_num[.@a], .levels[.@a]; sc_start .sc_effect[.@a], .ticks[.@a], .levels[.@a]; message strcharinfo(0),"Buff "+.skil_txt$[.@a]+" Added!"; } Zeny = Zeny - .@total; end; Sub_PriceCheck: for( .@a = 0; .@a < .len; .@a++ ) if( ( slc_bufs & pow( 2, .@a ) ) ) .@total = .@total + .price[.@a]; return .@total; Set_Buffs: .@slc_bufs = slc_bufs; .@total = callsub(Sub_PriceCheck); function sf { function s; .@a = getarg(2); .@len = getarg(3); return ( sprintf( getarg(0), s(.@a, .@len, getarg(1), getarg(4), getarg(5)), s(.@a++, .@len, getarg(1), getarg(4), getarg(5)), s(.@a++, .@len, getarg(1), getarg(4), getarg(5)), s(.@a++, .@len, getarg(1), getarg(4), getarg(5)), s(.@a++, .@len, getarg(1), getarg(4), getarg(5)), s(.@a++, .@len, getarg(1), getarg(4), getarg(5)), s(.@a++, .@len, getarg(1), getarg(4), getarg(5)), s(.@a++, .@len, getarg(1), getarg(4), getarg(5)), s(.@a++, .@len, getarg(1), getarg(4), getarg(5)), s(.@a++, .@len, getarg(1), getarg(4), getarg(5)) ) +(( .@a+1 < .@len )?":Next":":") +(( .@a-11 > 0 )?":Back":":") +":Done:Cancel" ); function s { if( getarg(0) >= getarg(1) ) return ""; else { .@name$ = getelementofarray( getarg(2), getarg(0) ); return .@name$==""?"":"Buff [ ^0054ff"+.@name$+"^000000 ] Lv"+getelementofarray( getarg(4), getarg(0) )+" [ "+(getarg(3)&pow(2,getarg(0))?"^35a100On":"^FF0000Off")+"^000000 ]"; } }; }; function nex { return((getarg(0)+10)<getarg(1)?getarg(0)+10:getarg(1)-(getarg(1)%10)); }; function bac { return((getarg(0)-10)>=0?getarg(0)-10:0); }; mes .npc_nm$; mes "Select your buffs!"; next; .@a = 0; while( 1 ) { select( sf( .format$, .skil_txt$, .@a, .len, .@slc_bufs, .levels ) ); switch( @menu ) { case 11: .@a = nex( .@a, .len ); break; case 12: .@a = bac( .@a ); break; case 13: mes .npc_nm$; mes "Alright, your current total will be "+.@total+"z each time you use my buffing service. Is that ok?"; next; if( select("Yes:No") == 1 ) slc_bufs = .@slc_bufs; case 14: end; default: .@select = .@a+@menu-1; if( ( .@slc_bufs & pow( 2, .@select ) ) ) { .@slc_bufs = .@slc_bufs - pow( 2, .@select ); .@total = .@total - .price[.@select]; } else { .@slc_bufs = .@slc_bufs + pow( 2, .@select ); .@total = .@total + .price[.@select]; } } } end; OnInit: .npc_nm$ = "[ "+strnpcinfo(1)+" ]"; setarray .sc_effect, SC_CP_WEAPON, SC_CONCENTRATE, SC_ASSUMPTIO, SC_TRUESIGHT, SC_MAXOVERTHRUST, SC_AUTOCOUNTER, SC_PROVIDENCE; setarray .skil_txt$, "Full Protection Lv5", "Attention Concentrate Lv10", "Assumptio Lv 5", "True Sight Lv 10", "Maximum Over Thrust Lv5", "Auto Guard Lv10", "Providence Lv 5"; setarray .ticks, 300000, 300000, 300000, 300000, 300000, 300000, 300000; setarray .price, 1000000, 3000000, 1000000, 3000000, 3000000, 3000000, 1000000; setarray .skil_num, 479, 45, 361, 380, 486, 249, 256; setarray .levels, 5, 10, 5, 10, 5, 10, 5; .format$ = "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s"; .len = getarraysize(.sc_effect); end; } So I changed the skills it does, but then after the NPC cast the buffs on me. My character cannot move nor sit down. Which buff skill makes my character not move? Quote
Skorm Posted August 15, 2014 Author Posted August 15, 2014 So I changed the skills it does, but then after the NPC cast the buffs on me. My character cannot move nor sit down. Which buff skill makes my character not move? Lol Maybe auto counter? Or this SC_CP_WEAPON? Quote
GodKnows Jhomz Posted November 18, 2018 Posted November 18, 2018 On 8/15/2014 at 11:58 AM, Skorm said: Lol Maybe auto counter? Or this SC_CP_WEAPON? Why is the first selection is doubled and don't show the last selection? It happens when I used hash a12f1ce. Back then when I'm using r17704, the selection is good without this problem. Any solution in this? Thanks. Quote
Skorm Posted November 18, 2018 Author Posted November 18, 2018 14 hours ago, GodKnows Jhomz said: Why is the first selection is doubled and don't show the last selection? It happens when I used hash a12f1ce. Back then when I'm using r17704, the selection is good without this problem. Any solution in this? Thanks. Thanks for letting me know I've got a fix I'll upload it when I get home from work. Quote
Thinker Posted November 21, 2018 Posted November 21, 2018 (edited) [Error]: script_rid2sd: fatal error ! player not attached! [Debug]: Function: setarray (8 parameters): [Debug]: Data: variable name='.sc_effect' index=0 [Debug]: Data: variable name='SC_INCREASEAGI' index=0 [Debug]: Data: number value=30 [Debug]: Data: number value=115 [Debug]: Data: number value=35 [Debug]: Data: number value=29 [Debug]: Data: number value=40 [Debug]: Data: number value=41 [Debug]: Source (NPC): Buffer at prontera (157,162) @edit Fixed Edited November 21, 2018 by Thinker Quote
Radian Posted November 29, 2018 Posted November 29, 2018 @Skorm I have a suggestion for this one. since you need to talk to the npc to setup which of those buffs you want to be enabled. why not make a command where players can use it anywhere anytime. but that checks if they have the right amount of zeny. Quote
Skorm Posted November 29, 2018 Author Posted November 29, 2018 (edited) 14 hours ago, Radian said: @Skorm I have a suggestion for this one. since you need to talk to the npc to setup which of those buffs you want to be enabled. why not make a command where players can use it anywhere anytime. but that checks if they have the right amount of zeny. I like that idea. I also wanted to add an option where you could split the npcs up. So one for changing buffs and one for setting buffs since double-clicking is a little dodgy. Edit: @Radian Done. Edited November 29, 2018 by Skorm 1 1 Quote
Radian Posted November 29, 2018 Posted November 29, 2018 4 hours ago, Skorm said: Edit: @Radian Done. Nice works perfectly. Thank you Quote
LearningRO Posted November 30, 2018 Posted November 30, 2018 how to make this buff read guild id??? Quote
yodaGG Posted December 16, 2024 Posted December 16, 2024 anyone know how to split this buff to 2 NPC ? 1. For do buff 1. for setting the buff Quote
Skorm Posted December 17, 2024 Author Posted December 17, 2024 6 hours ago, yodaGG said: anyone know how to split this buff to 2 NPC ? 1. For do buff 1. for setting the buff If there is an NPC with "set" in the hidden part of its name then duplicate NPCs without set in their name are buffers and ones with it are setters. Granted in retrospect this is a little annoying because you can only ever have the two system or the one system on a server never both via duplicates. Here is an example of a setter NPC. // Any duplicate npc with a hidden name that contains "set" will be considered a buff setter. For Example, set1, set2, or setting are all valid hidden names. // To enable one-npc-mode where double clicking on the same npc allows for buffs to be changed. Just remove all duplicate npcs with "set" in their hidden names. prontera,152,150,4 duplicate(Buffer) Buff Setter#set 100 1 1 Quote
yodaGG Posted December 17, 2024 Posted December 17, 2024 5 hours ago, Skorm said: If there is an NPC with "set" in the hidden part of its name then duplicate NPCs without set in their name are buffers and ones with it are setters. Granted in retrospect this is a little annoying because you can only ever have the two system or the one system on a server never both via duplicates. Here is an example of a setter NPC. // Any duplicate npc with a hidden name that contains "set" will be considered a buff setter. For Example, set1, set2, or setting are all valid hidden names. // To enable one-npc-mode where double clicking on the same npc allows for buffs to be changed. Just remove all duplicate npcs with "set" in their hidden names. prontera,152,150,4 duplicate(Buffer) Buff Setter#set 100 Ohhhhh ic ic Sorry", thankkyouuu @Skorm Quote
yodaGG Posted December 20, 2024 Posted December 20, 2024 Sorry for asking again , how to add item buff effect ? bcs this item have no Skill ID and Level ex: Earthproof Potion Item ID# 12120 (Resist_Earth) { sc_start4 SC_ARMOR_ELEMENT_EARTH,1200000,0,20,-15,0; },{},{} Quote
Skorm Posted December 22, 2024 Author Posted December 22, 2024 On 12/20/2024 at 2:24 PM, yodaGG said: Sorry for asking again , how to add item buff effect ? bcs this item have no Skill ID and Level ex: Earthproof Potion Item ID# 12120 (Resist_Earth) { sc_start4 SC_ARMOR_ELEMENT_EARTH,1200000,0,20,-15,0; },{},{} I don't think there's an option for that. I'll find time to add it tomorrow. 1 Quote
Skorm Posted December 25, 2024 Author Posted December 25, 2024 On 12/20/2024 at 2:24 PM, yodaGG said: Sorry for asking again , how to add item buff effect ? bcs this item have no Skill ID and Level ex: Earthproof Potion Item ID# 12120 (Resist_Earth) { sc_start4 SC_ARMOR_ELEMENT_EARTH,1200000,0,20,-15,0; },{},{} Can you test this and let me know if you have any issues. I'll upload it if you give the all clear. ///This function takes an array of strings and builds a menu players can navigate. ///Usage: f_displayPages(.@string_array${, .@page_size {, .@extra_string_array$}}); ///Output: This function returns the selected item index from the given array. function script f_displayPages { .@page_size = getarg(1, 10); .@len = getarraysize(getarg(0)); .@pages = .@len / .@page_size; .@pages -= .@len > .@page_size && .@len % .@page_size ? 0 : 1; .@foo_len = getarraysize(getarg(2, .@foo$)); copyarray .@foo$[0], getarg(2, .@foo$), .@foo_len; .@foo$[0] = .@foo_len ? .@foo$[0] : "foo"; // This is only here to avoid warnings. do { copyarray .@copy$[0], getelementofarray(getarg(0), .@page_size * .@page), .@page_size; if( .@page < .@pages ) .@copy$[.@page_size] = "Next Page =>"; if( .@page > 0 ) .@copy$[.@page_size +1] = "<= Previous Page"; .@menu = select(implode(.@copy$,":")+( .@foo_len ? ":" + implode(.@foo$,":") : "" )); if( .@menu == .@page_size +1 ) .@page++; else if( .@menu == .@page_size +2 ) .@page--; else if( .@menu > getarraysize(.@copy$) ) return getarraysize(.@copy$) - .@menu; deletearray .@copy$; } while( .@menu > .@page_size ); .@menu += .@page_size * .@page; return .@menu-1; } function script f_timeKeep { function s; set .@left, getarg(0); if ( .@left <= 0 ) return getarg(0); set .@day, .@left / 86400; set .@hour, .@left % 86400 / 3600; set .@min, .@left % 3600 / 60; set .@sec, .@left % 60; .@mes$ = ( .@day ? .@day +" day"+ s( .@day ) : "" ) + ( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) + ( .@min ? .@min +" minute"+ s( .@min ) : "" ) + ( .@sec ? .@sec +" second"+ s( .@sec,1 ) : "" ); if ( charat( .@mes$, getstrlen(.@mes$)-1 ) == " " ) .@mes$ = delchar( .@mes$, getstrlen(.@mes$)-1 ); return ( .@mes$ ); function s { return ( ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " ) ); } } // By Skorm... Selection Buffer Version 2.2 prontera,150,150,5 script Buffer 100,{ if( @h_last > gettimetick(2) && !.dual_mode || compare(strnpcinfo(2),"set") || !slc_bufs ) goto OnSetBuff; OnBuff: if( @h_last > gettimetick(2) ) end; @h_last = gettimetick(2) + .trigger; .@total = callsub(Sub_PriceCheck); if( .@total > Zeny ) { message strcharinfo(0), "You don't have enough Zeny to buff "+( .dual_mode ? "" : "double ")+"click the "+( .dual_mode ? "Buff Setter" : "Buffer ")+"to modify your selection."; end; } for( .@a = 0; .@a < .len; .@a++ ) if( ( slc_bufs & pow( 2, .@a ) ) ) { switch(.sc_num[.@a]) { case 0: case 1: skilleffect .skil_num[.@a], .levels[.@a]; sc_start .sc_effect[.@a], .ticks[.@a], .levels[.@a]; break; case 2: case 3: sc_start2 .sc_effect[.@a], .ticks[.@a], .levels[.@a], .sc_arg1[.@a]; break; case 4: sc_start4 .sc_effect[.@a], .ticks[.@a], .levels[.@a], .sc_arg1[.@a], .sc_arg2[.@a]; break; } message strcharinfo(0),"Buff "+.skil_txt$[.@a]+" Added!"; } Zeny = Zeny - .@total; end; Sub_PriceCheck: for( .@a = 0; .@a < .len; .@a++ ) if( ( slc_bufs & pow( 2, .@a ) ) ) .@total = .@total + .price[.@a]; return .@total; OnSetBuff: .@slc_bufs = slc_bufs; .@total = callsub(Sub_PriceCheck); .@len = getarraysize(.skil_txt$); for (.@i = 0; .@i < .@len; .@i++) .@buffs$[.@i] = "( "+(.@slc_bufs&pow(2,.@i)?"^35a100On":"^FF0000Off")+"^000000 ) [ ^0054ff"+.skil_txt$[.@i]+(.sc_num < 2 ? " Lv"+.levels[.@i] : "")+"^000000 ] "+F_InsertComma(.price[.@i])+"z, "+f_timeKeep(.ticks[.@i]/1000); do { mes .npc_nm$; mes "Select your buffs!"; .@select = f_displayPages(.@buffs$, .page_size, .format$); next; switch( .@select ) { case -1: mes .npc_nm$; mes "Alright, your current total will be "+F_InsertComma(.@total)+"z each time you use my buffing service. Is that ok?"; next; if( select( "Yes:No" ) == 1 ) slc_bufs = .@slc_bufs; break; default: .@total = ( .@slc_bufs & pow( 2, .@select ) ) ? .@total - .price[.@select] : .@total + .price[.@select]; .@slc_bufs = .@slc_bufs ^ pow( 2, .@select ); .@buffs$[.@select] = "( "+(.@slc_bufs&pow(2,.@select)?"^35a100On":"^FF0000Off")+"^000000 ) [ ^0054ff"+.skil_txt$[.@select]+(.sc_num < 2 ? " Lv"+.levels[.@select] : "")+"^000000 ] "+F_InsertComma(.price[.@select])+"z, "+f_timeKeep(.ticks[.@select]/1000); } } while ( .@select > -1 ); end; function add_sc_effect { if(getargcount() <= 6) { .sc_num[.effect_size] = 0; } else if(getargcount() <= 7) { .sc_num[.effect_size] = 2; } else { .sc_num[.effect_size] = 4; } .sc_effect[.effect_size] = getarg(0, SC_INCREASEAGI); .skil_txt$[.effect_size] = getarg(1, "Increase Agi"); .ticks[.effect_size] = getarg(2, 300000); .price[.effect_size] = getarg(3, 1000); .skil_num[.effect_size] = getarg(4, 29); .levels[.effect_size] = getarg(5, 10); .sc_arg1[.effect_size] = getarg(6, 0); .sc_arg2[.effect_size] = getarg(7, 0); .effect_size++; } OnInit: if(compare(strnpcinfo(2),"set")) .dual_mode = 1; .npc_nm$ = "[ "+strnpcinfo(1)+" ]"; // Only the first loaded NPC can continue... if(.len) end; // SC_EFFECT, TEXT, TICKS, PRICE, ARG1(Skill Number), ARG2(Skill Level), ARG3, ARG4; add_sc_effect(SC_INCREASEAGI, "Increase Agi", 300000, 1000, 29, 10); add_sc_effect(SC_BLESSING, "Blessing", 300000, 1000, 34, 10); add_sc_effect(SC_ASSUMPTIO, "Assumptio", 300000, 5000, 361, 5); add_sc_effect(SC_IMPOSITIO, "Impositio", 300000, 5000, 66, 5); add_sc_effect(SC_ANGELUS, "Angelus", 300000, 5000, 33, 5); add_sc_effect(SC_MAGNIFICAT, "Magnificat", 300000, 10000, 74, 5); add_sc_effect(SC_GLORIA, "Gloria", 300000, 10000, 75, 5); add_sc_effect(SC_ARMOR_ELEMENT_EARTH, "Earthproof", 1200000, 10000, 0, 20, -15, 0); setarray .format$, "Done"; // This is the conformation button at the end of the menu. .page_size = 10; // Buffs shown per page. .trigger = 2; // Number of seconds between clicks to not trigger select page. .len = getarraysize(.sc_effect); bindatcmd "setbuff",strnpcinfo(0)+"::OnSetBuff"; bindatcmd "buff",strnpcinfo(0)+"::OnBuff"; } // Any duplicate npc with a hidden name that contains "set" will be considered a buff setter. For Example, set1, set2, or setting are all valid hidden names. // To enable one-npc-mode where double clicking on the same npc allows for buffs to be changed. Just remove all duplicate npcs with "set" in their hidden names. prontera,152,150,4 duplicate(Buffer) Buff Setter#set 100 Quote
yodaGG Posted December 25, 2024 Posted December 25, 2024 (edited) Quote Can you test this and let me know if you have any issues. I'll upload it if you give the all clear. Wow nicee bro. I have try, and showing this Quote [Error]: Loading NPC file: npc/custom/betTbet/SELECTED_BUFF.txt script error on npc/custom/betTbet/SELECTED_BUFF.txt line 83 parse_callfunc: not enough arguments, expected ',' 78 : case 2: 79 : case 3: 80 : sc_start2 .sc_effect[.@a], .ticks[.@a], .levels[.@a], .sc_arg1[.@a]; 81 : break; 82 : case 4: * 83 : sc_start4 .sc_effect[.@a], .ticks[.@a], .levels[.@a], .sc_arg1[.@a], .sc_arg2[.@a]';' 84 : break; 85 : } 86 : message strcharinfo(0),"Buff "+.skil_txt$[.@a]+" Added!"; 87 : } 88 : [Info]: Done loading '13038' NPCs: Edited December 25, 2024 by yodaGG Wrong pict. sorry Quote
Skorm Posted December 26, 2024 Author Posted December 26, 2024 7 hours ago, yodaGG said: Wow nicee bro. I have try, and showing this ///This function takes an array of strings and builds a menu players can navigate. ///Usage: f_displayPages(.@string_array${, .@page_size {, .@extra_string_array$}}); ///Output: This function returns the selected item index from the given array. function script f_displayPages { .@page_size = getarg(1, 10); .@len = getarraysize(getarg(0)); .@pages = .@len / .@page_size; .@pages -= .@len > .@page_size && .@len % .@page_size ? 0 : 1; .@foo_len = getarraysize(getarg(2, .@foo$)); copyarray .@foo$[0], getarg(2, .@foo$), .@foo_len; .@foo$[0] = .@foo_len ? .@foo$[0] : "foo"; // This is only here to avoid warnings. do { copyarray .@copy$[0], getelementofarray(getarg(0), .@page_size * .@page), .@page_size; if( .@page < .@pages ) .@copy$[.@page_size] = "Next Page =>"; if( .@page > 0 ) .@copy$[.@page_size +1] = "<= Previous Page"; .@menu = select(implode(.@copy$,":")+( .@foo_len ? ":" + implode(.@foo$,":") : "" )); if( .@menu == .@page_size +1 ) .@page++; else if( .@menu == .@page_size +2 ) .@page--; else if( .@menu > getarraysize(.@copy$) ) return getarraysize(.@copy$) - .@menu; deletearray .@copy$; } while( .@menu > .@page_size ); .@menu += .@page_size * .@page; return .@menu-1; } function script f_timeKeep { function s; set .@left, getarg(0); if ( .@left <= 0 ) return getarg(0); set .@day, .@left / 86400; set .@hour, .@left % 86400 / 3600; set .@min, .@left % 3600 / 60; set .@sec, .@left % 60; .@mes$ = ( .@day ? .@day +" day"+ s( .@day ) : "" ) + ( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) + ( .@min ? .@min +" minute"+ s( .@min ) : "" ) + ( .@sec ? .@sec +" second"+ s( .@sec,1 ) : "" ); if ( charat( .@mes$, getstrlen(.@mes$)-1 ) == " " ) .@mes$ = delchar( .@mes$, getstrlen(.@mes$)-1 ); return ( .@mes$ ); function s { return ( ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " ) ); } } // By Skorm... Selection Buffer Version 2.2 prontera,150,150,5 script Buffer 100,{ if( @h_last > gettimetick(2) && !.dual_mode || compare(strnpcinfo(2),"set") || !slc_bufs ) goto OnSetBuff; OnBuff: if( @h_last > gettimetick(2) ) end; @h_last = gettimetick(2) + .trigger; .@total = callsub(Sub_PriceCheck); if( .@total > Zeny ) { message strcharinfo(0), "You don't have enough Zeny to buff "+( .dual_mode ? "" : "double ")+"click the "+( .dual_mode ? "Buff Setter" : "Buffer ")+"to modify your selection."; end; } for( .@a = 0; .@a < .len; .@a++ ) if( ( slc_bufs & pow( 2, .@a ) ) ) { switch(.sc_num[.@a]) { case 0: case 1: skilleffect .skil_num[.@a], .levels[.@a]; sc_start .sc_effect[.@a], .ticks[.@a], .levels[.@a]; break; case 2: case 3: sc_start2 .sc_effect[.@a], .ticks[.@a], .skil_num[.@a], .levels[.@a]; break; case 4: sc_start4 .sc_effect[.@a], .ticks[.@a], .skil_num[.@a], .levels[.@a], .sc_arg1[.@a], .sc_arg2[.@a]; break; } message strcharinfo(0),"Buff "+.skil_txt$[.@a]+" Added!"; } Zeny = Zeny - .@total; end; Sub_PriceCheck: for( .@a = 0; .@a < .len; .@a++ ) if( ( slc_bufs & pow( 2, .@a ) ) ) .@total = .@total + .price[.@a]; return .@total; OnSetBuff: .@slc_bufs = slc_bufs; .@total = callsub(Sub_PriceCheck); .@len = getarraysize(.skil_txt$); for (.@i = 0; .@i < .@len; .@i++) .@buffs$[.@i] = "( "+(.@slc_bufs&pow(2,.@i)?"^35a100On":"^FF0000Off")+"^000000 ) [ ^0054ff"+.skil_txt$[.@i]+(.sc_num < 2 ? " Lv"+.levels[.@i] : "")+"^000000 ] "+F_InsertComma(.price[.@i])+"z, "+f_timeKeep(.ticks[.@i]/1000); do { mes .npc_nm$; mes "Select your buffs!"; .@select = f_displayPages(.@buffs$, .page_size, .format$); next; switch( .@select ) { case -1: mes .npc_nm$; mes "Alright, your current total will be "+F_InsertComma(.@total)+"z each time you use my buffing service. Is that ok?"; next; if( select( "Yes:No" ) == 1 ) slc_bufs = .@slc_bufs; break; default: .@total = ( .@slc_bufs & pow( 2, .@select ) ) ? .@total - .price[.@select] : .@total + .price[.@select]; .@slc_bufs = .@slc_bufs ^ pow( 2, .@select ); .@buffs$[.@select] = "( "+(.@slc_bufs&pow(2,.@select)?"^35a100On":"^FF0000Off")+"^000000 ) [ ^0054ff"+.skil_txt$[.@select]+(.sc_num < 2 ? " Lv"+.levels[.@select] : "")+"^000000 ] "+F_InsertComma(.price[.@select])+"z, "+f_timeKeep(.ticks[.@select]/1000); } } while ( .@select > -1 ); end; function add_sc_effect { if(getargcount() <= 6) { .sc_num[.effect_size] = 0; } else if(getargcount() <= 7) { .sc_num[.effect_size] = 2; } else { .sc_num[.effect_size] = 4; } .sc_effect[.effect_size] = getarg(0, SC_INCREASEAGI); .skil_txt$[.effect_size] = getarg(1, "Increase Agi"); .ticks[.effect_size] = getarg(2, 300000); .price[.effect_size] = getarg(3, 1000); .skil_num[.effect_size] = getarg(4, 29); .levels[.effect_size] = getarg(5, 10); .sc_arg1[.effect_size] = getarg(6, 0); .sc_arg2[.effect_size] = getarg(7, 0); .effect_size++; } OnInit: if(compare(strnpcinfo(2),"set")) .dual_mode = 1; .npc_nm$ = "[ "+strnpcinfo(1)+" ]"; // Only the first loaded NPC can continue... if(.len) end; // SC_EFFECT, TEXT, TICKS, PRICE, ARG1(Skill Number), ARG2(Skill Level), ARG3, ARG4; add_sc_effect(SC_INCREASEAGI, "Increase Agi", 300000, 1000, 29, 10); add_sc_effect(SC_BLESSING, "Blessing", 300000, 1000, 34, 10); add_sc_effect(SC_ASSUMPTIO, "Assumptio", 300000, 5000, 361, 5); add_sc_effect(SC_IMPOSITIO, "Impositio", 300000, 5000, 66, 5); add_sc_effect(SC_ANGELUS, "Angelus", 300000, 5000, 33, 5); add_sc_effect(SC_MAGNIFICAT, "Magnificat", 300000, 10000, 74, 5); add_sc_effect(SC_GLORIA, "Gloria", 300000, 10000, 75, 5); add_sc_effect(SC_ARMOR_ELEMENT_EARTH, "Earthproof", 1200000, 10000, 0, 20, -15, 0); setarray .format$, "Done"; // This is the conformation button at the end of the menu. .page_size = 10; // Buffs shown per page. .trigger = 2; // Number of seconds between clicks to not trigger select page. .len = getarraysize(.sc_effect); bindatcmd "setbuff",strnpcinfo(0)+"::OnSetBuff"; bindatcmd "buff",strnpcinfo(0)+"::OnBuff"; } // Any duplicate npc with a hidden name that contains "set" will be considered a buff setter. For Example, set1, set2, or setting are all valid hidden names. // To enable one-npc-mode where double clicking on the same npc allows for buffs to be changed. Just remove all duplicate npcs with "set" in their hidden names. prontera,152,150,4 duplicate(Buffer) Buff Setter#set 100 1 Quote
yodaGG Posted December 26, 2024 Posted December 26, 2024 7 hours ago, Skorm said: ///This function takes an array of strings and builds a menu players can navigate. ///Usage: f_displayPages(.@string_array${, .@page_size {, .@extra_string_array$}}); ///Output: This function returns the selected item index from the given array. function script f_displayPages { .@page_size = getarg(1, 10); .@len = getarraysize(getarg(0)); .@pages = .@len / .@page_size; .@pages -= .@len > .@page_size && .@len % .@page_size ? 0 : 1; .@foo_len = getarraysize(getarg(2, .@foo$)); copyarray .@foo$[0], getarg(2, .@foo$), .@foo_len; .@foo$[0] = .@foo_len ? .@foo$[0] : "foo"; // This is only here to avoid warnings. do { copyarray .@copy$[0], getelementofarray(getarg(0), .@page_size * .@page), .@page_size; if( .@page < .@pages ) .@copy$[.@page_size] = "Next Page =>"; if( .@page > 0 ) .@copy$[.@page_size +1] = "<= Previous Page"; .@menu = select(implode(.@copy$,":")+( .@foo_len ? ":" + implode(.@foo$,":") : "" )); if( .@menu == .@page_size +1 ) .@page++; else if( .@menu == .@page_size +2 ) .@page--; else if( .@menu > getarraysize(.@copy$) ) return getarraysize(.@copy$) - .@menu; deletearray .@copy$; } while( .@menu > .@page_size ); .@menu += .@page_size * .@page; return .@menu-1; } function script f_timeKeep { function s; set .@left, getarg(0); if ( .@left <= 0 ) return getarg(0); set .@day, .@left / 86400; set .@hour, .@left % 86400 / 3600; set .@min, .@left % 3600 / 60; set .@sec, .@left % 60; .@mes$ = ( .@day ? .@day +" day"+ s( .@day ) : "" ) + ( .@hour ? .@hour +" hour"+ s( .@hour ) : "" ) + ( .@min ? .@min +" minute"+ s( .@min ) : "" ) + ( .@sec ? .@sec +" second"+ s( .@sec,1 ) : "" ); if ( charat( .@mes$, getstrlen(.@mes$)-1 ) == " " ) .@mes$ = delchar( .@mes$, getstrlen(.@mes$)-1 ); return ( .@mes$ ); function s { return ( ( getarg(0) > 1 ? "s" : "" ) + ( getarg(1,0) ? "" : " " ) ); } } // By Skorm... Selection Buffer Version 2.2 prontera,150,150,5 script Buffer 100,{ if( @h_last > gettimetick(2) && !.dual_mode || compare(strnpcinfo(2),"set") || !slc_bufs ) goto OnSetBuff; OnBuff: if( @h_last > gettimetick(2) ) end; @h_last = gettimetick(2) + .trigger; .@total = callsub(Sub_PriceCheck); if( .@total > Zeny ) { message strcharinfo(0), "You don't have enough Zeny to buff "+( .dual_mode ? "" : "double ")+"click the "+( .dual_mode ? "Buff Setter" : "Buffer ")+"to modify your selection."; end; } for( .@a = 0; .@a < .len; .@a++ ) if( ( slc_bufs & pow( 2, .@a ) ) ) { switch(.sc_num[.@a]) { case 0: case 1: skilleffect .skil_num[.@a], .levels[.@a]; sc_start .sc_effect[.@a], .ticks[.@a], .levels[.@a]; break; case 2: case 3: sc_start2 .sc_effect[.@a], .ticks[.@a], .skil_num[.@a], .levels[.@a]; break; case 4: sc_start4 .sc_effect[.@a], .ticks[.@a], .skil_num[.@a], .levels[.@a], .sc_arg1[.@a], .sc_arg2[.@a]; break; } message strcharinfo(0),"Buff "+.skil_txt$[.@a]+" Added!"; } Zeny = Zeny - .@total; end; Sub_PriceCheck: for( .@a = 0; .@a < .len; .@a++ ) if( ( slc_bufs & pow( 2, .@a ) ) ) .@total = .@total + .price[.@a]; return .@total; OnSetBuff: .@slc_bufs = slc_bufs; .@total = callsub(Sub_PriceCheck); .@len = getarraysize(.skil_txt$); for (.@i = 0; .@i < .@len; .@i++) .@buffs$[.@i] = "( "+(.@slc_bufs&pow(2,.@i)?"^35a100On":"^FF0000Off")+"^000000 ) [ ^0054ff"+.skil_txt$[.@i]+(.sc_num < 2 ? " Lv"+.levels[.@i] : "")+"^000000 ] "+F_InsertComma(.price[.@i])+"z, "+f_timeKeep(.ticks[.@i]/1000); do { mes .npc_nm$; mes "Select your buffs!"; .@select = f_displayPages(.@buffs$, .page_size, .format$); next; switch( .@select ) { case -1: mes .npc_nm$; mes "Alright, your current total will be "+F_InsertComma(.@total)+"z each time you use my buffing service. Is that ok?"; next; if( select( "Yes:No" ) == 1 ) slc_bufs = .@slc_bufs; break; default: .@total = ( .@slc_bufs & pow( 2, .@select ) ) ? .@total - .price[.@select] : .@total + .price[.@select]; .@slc_bufs = .@slc_bufs ^ pow( 2, .@select ); .@buffs$[.@select] = "( "+(.@slc_bufs&pow(2,.@select)?"^35a100On":"^FF0000Off")+"^000000 ) [ ^0054ff"+.skil_txt$[.@select]+(.sc_num < 2 ? " Lv"+.levels[.@select] : "")+"^000000 ] "+F_InsertComma(.price[.@select])+"z, "+f_timeKeep(.ticks[.@select]/1000); } } while ( .@select > -1 ); end; function add_sc_effect { if(getargcount() <= 6) { .sc_num[.effect_size] = 0; } else if(getargcount() <= 7) { .sc_num[.effect_size] = 2; } else { .sc_num[.effect_size] = 4; } .sc_effect[.effect_size] = getarg(0, SC_INCREASEAGI); .skil_txt$[.effect_size] = getarg(1, "Increase Agi"); .ticks[.effect_size] = getarg(2, 300000); .price[.effect_size] = getarg(3, 1000); .skil_num[.effect_size] = getarg(4, 29); .levels[.effect_size] = getarg(5, 10); .sc_arg1[.effect_size] = getarg(6, 0); .sc_arg2[.effect_size] = getarg(7, 0); .effect_size++; } OnInit: if(compare(strnpcinfo(2),"set")) .dual_mode = 1; .npc_nm$ = "[ "+strnpcinfo(1)+" ]"; // Only the first loaded NPC can continue... if(.len) end; // SC_EFFECT, TEXT, TICKS, PRICE, ARG1(Skill Number), ARG2(Skill Level), ARG3, ARG4; add_sc_effect(SC_INCREASEAGI, "Increase Agi", 300000, 1000, 29, 10); add_sc_effect(SC_BLESSING, "Blessing", 300000, 1000, 34, 10); add_sc_effect(SC_ASSUMPTIO, "Assumptio", 300000, 5000, 361, 5); add_sc_effect(SC_IMPOSITIO, "Impositio", 300000, 5000, 66, 5); add_sc_effect(SC_ANGELUS, "Angelus", 300000, 5000, 33, 5); add_sc_effect(SC_MAGNIFICAT, "Magnificat", 300000, 10000, 74, 5); add_sc_effect(SC_GLORIA, "Gloria", 300000, 10000, 75, 5); add_sc_effect(SC_ARMOR_ELEMENT_EARTH, "Earthproof", 1200000, 10000, 0, 20, -15, 0); setarray .format$, "Done"; // This is the conformation button at the end of the menu. .page_size = 10; // Buffs shown per page. .trigger = 2; // Number of seconds between clicks to not trigger select page. .len = getarraysize(.sc_effect); bindatcmd "setbuff",strnpcinfo(0)+"::OnSetBuff"; bindatcmd "buff",strnpcinfo(0)+"::OnBuff"; } // Any duplicate npc with a hidden name that contains "set" will be considered a buff setter. For Example, set1, set2, or setting are all valid hidden names. // To enable one-npc-mode where double clicking on the same npc allows for buffs to be changed. Just remove all duplicate npcs with "set" in their hidden names. prontera,152,150,4 duplicate(Buffer) Buff Setter#set 100 I just tested, itss workinggg. no error Thankkyouuu so much for ur update sir Quote
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.