ThyroDree 3 Posted April 7, 2020 (edited) Hello how can I add 2 more zeroes to ms? also can add 5 top breakers not only the fastest one? heres the script im using.. //===== rAthena Script ======================================= //= Emperium Break Room //===== By: ================================================== //= Masao //===== Current Version: ===================================== //= 1.0 //===== Compatible With: ===================================== //= rAthena SVN //===== Description: ========================================= //= An little Emperium Break Room NPC in which you can test your //= strength and speed against Emperiums. //===== Additional Comments: ================================= //= 1.0 First Version. [Masao] //============================================================ prontera,145,173,5 script Emperium Breaker 4_GEFFEN_14,{ set .@emp_time,$empbrk_record; set .@emp_m,.@emp_time / 60000; set .@emp_s,.@emp_time / 1000; set .@emp_ms,.@emp_time / 10000; set .@time,empbrk_record; set .@m,.@time / 60000; set .@s,.@time / 1000; set .@ms,.@time / 10000; mes "[ ^FF0000Emperium Breaker^000000 ]";; mes "^FF0000Your Latest Record^000000: "+.@s+"."+.@ms+" Seconds."; mes "^FF0000Top Breaker^000000: "+$empbrk_master$+""; mes "^0000FFTime Taken^000000: [ "+.@emp_s+"."+.@emp_ms+" Sec. ]"; next; mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "Would you like to try to set a new record?"; next; if (getgmlevel() >= 20) { menu "Standard Menu",-,"Reset",L_RO,"Reset Rooms",L_RR,"Cancel",L_C; menu "Yes",-,"No",L_C,"Reset",L_R; } else { menu "Yes",-,"No",L_C,"Reset",L_R; } cleararray .arena$[0],"",4; mes "[ ^FF0000Emperium Breaker^000000 ]"; if (getareausers("pvp_n_4-5",94,128,105,139)){ mes "Emperium Room 1: ^FF0000 Busy^000000"; }else{ mes "Emperium Room 1: ^00A000 Free^000000"; set .arena$[0],"Emperium Room 1"; } if (getareausers("pvp_n_4-5",60,94,71,105)){ mes "Emperium Room 2: ^FF0000 Busy^000000"; }else{ mes "Emperium Room 2: ^00A000 Free^000000"; set .arena$[1],"Emperium Room 2"; } if (getareausers("pvp_n_4-5",94,60,105,71)){ mes "Emperium Room 3: ^FF0000 Busy^"; }else{ mes "Emperium Room 3: ^00A000 Free^000000"; set .arena$[2],"Emperium Room 3"; } if (getareausers("pvp_n_4-5",128,94,139,105)){ mes "Emperium Room 4: ^FF0000 Busy^000000"; }else{ mes "Emperium Room 4: ^00A000 Free^000000"; set .arena$[3],"Emperium Room 4"; } next; switch (select(.arena$[0],.arena$[1],.arena$[2],.arena$[3],"Exit")){ case 1: if (getareausers("pvp_n_4-5",60,94,71,105) == 0){ if($@empr_occupied[0] > 0){ mes "[Emperium Breaker]"; mes "This room is currently occupied, please try again later."; close; } close2; set $@empr_occupied[0],1; set $@empbrk_charid[0],getcharid(0); warp "pvp_n_4-5",99,128; initnpctimer "EmpBrk#1"; sc_end SC_ALL; end; } mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "This room is currently occupied, please try again later."; close; case 2: if (getareausers("pvp_n_4-5",60,94,71,105) == 0){ if($@empr_occupied[1] > 0){ mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "This room is currently occupied, please try again later."; close; } close2; set $@empr_occupied[1],1; set $@empbrk_charid[1],getcharid(0); warp "pvp_n_4-5",68,99; initnpctimer "EmpBrk#2"; sc_end SC_ALL; end; } mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "This room is currently occupied, please try again later."; close; case 3: if (getareausers("pvp_n_4-5",94,60,105,71) == 0){ if($@empr_occupied[2] > 0){ mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "This room is currently occupied, please try again later."; close; } close2; set $@empr_occupied[2],1; set $@empbrk_charid[2],getcharid(0); warp "pvp_n_4-5",100,68; initnpctimer "EmpBrk#3"; sc_end SC_ALL; end; } mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "This room is currently occupied, please try again later."; close; case 4: if (getareausers("pvp_n_4-5",128,94,139,105) == 0){ if($@empr_occupied[3] > 0){ mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "This room is currently occupied, please try again later."; close; } close2; set $@empr_occupied[3],1; set $@empbrk_charid[3],getcharid(0); warp "pvp_n_4-5",130,99; initnpctimer "EmpBrk#4"; sc_end SC_ALL; end; } mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "This room is currently occupied, please try again later."; close; case 5: close; } L_RO: mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "Are you sure you want to reset the official record?"; next; menu "Yes",-,"No",L_C; set $empbrk_record,0; set $empbrk_master$,""; close; L_R: mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "Are you sure you want to reset your record?"; next; menu "Yes",-,"No",L_C; set empbrk_record,0; close; L_RR: mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "Rooms have been reset."; cleararray $@empr_occupied[0],0,4; close; L_C: close; } - script EmpBrk#1 -1,{ OnTimer5000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"Get ready to break the Emperium!",bc_area; end; OnTimer8000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"5",bc_area; end; OnTimer9000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"4",bc_area; end; OnTimer10000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"3",bc_area; end; OnTimer11000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"2",bc_area; end; OnTimer12000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"1",bc_area; end; OnTimer13000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"GO!!!",bc_area; monster "pvp_n_4-5",.xe,.ye,"Emperium",EMPELIUM,1,"EmpBrk#1::OnEmpBreak"; end; OnTimer600000: warpchar "prontera",156,191,$@empbrk_charid[0]; killmonster "pvp_n_4-5","EmpBrk#1::OnEmpBreak"; set $@empr_occupied[0],0; stopnpctimer; end; OnEmpBreak: stopnpctimer; set .current_time,getnpctimer(0,"EmpBrk#1"); set .new_time,.current_time - 13000; if (.new_time < empbrk_record || empbrk_record == 0) { areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"New Own Record!!!",bc_area; set empbrk_record,.new_time; } if (.new_time < $empbrk_record || $empbrk_record == 0) { announce strcharinfo(0)+" is now the new No. 1 Emperium Breaker!!",bc_all; set $empbrk_record,.new_time; set $empbrk_master$,strcharinfo(0); } set .m,.new_time / 60000; set .s,.new_time / 1000; set .ms,.new_time / 10000; if(.m < 0){ set .m,0; } if(.s < 0){ set .s,0; } set $@empr_occupied[0],0; areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"Your time is "+.m+"m "+.s+"s "+.ms+"ms",bc_area; warpchar "prontera",156,191,$@empbrk_charid[0]; end; OnInit: set .x1,94; set .y1,128; set .x2,105; set .y2,139; set .xe,100; set .ye,134; end; } pvp_n_4-5,99,125,0 script EmpBrk#1_touch FAKE_NPC,3,1,{ OnTouch: mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "You cannot exit your square!"; close2; warp "pvp_n_4-5",99,128; end; } - script EmpBrk#2 -1,{ OnTimer5000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"Get ready to break the Emperium!",bc_area; end; OnTimer8000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"5",bc_area; end; OnTimer9000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"4",bc_area; end; OnTimer10000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"3",bc_area; end; OnTimer11000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"2",bc_area; end; OnTimer12000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"1",bc_area; end; OnTimer13000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"GO!!!",bc_area; monster "pvp_n_4-5",.xe,.ye,"Emperium",EMPELIUM,1,"EmpBrk#2::OnEmpBreak"; end; OnTimer600000: warpchar "prontera",156,191,$@empbrk_charid[1]; killmonster "pvp_n_4-5","EmpBrk#2::OnEmpBreak"; set $@empr_occupied[1],0; stopnpctimer; end; OnEmpBreak: stopnpctimer; set .current_time,getnpctimer(0,"EmpBrk#2"); set .new_time,.current_time - 13000; if (.new_time < empbrk_record || empbrk_record == 0) { areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"New Own Record!!!",bc_area; set empbrk_record,.new_time; } if (.new_time < $empbrk_record || $empbrk_record == 0) { announce strcharinfo(0)+" is now the new No. 1 Emperium Breaker!!",bc_all; set $empbrk_record,.new_time; set $empbrk_master$,strcharinfo(0); } set .m,.new_time / 60000; set .s,.new_time / 1000; set .ms,.new_time / 10000; if(.m < 0){ set .m,0; } if(.s < 0){ set .s,0; } areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"Your time is "+.m+"m "+.s+"s "+.ms+"ms",bc_area; warpchar "prontera",156,191,$@empbrk_charid[1]; set $@empr_occupied[1],0; end; OnInit: set .x1,60; set .y1,94; set .x2,71; set .y2,105; set .xe,65; set .ye,99; end; } pvp_n_4-5,74,99,0 script EmpBrk#2_touch FAKE_NPC,1,3,{ OnTouch: mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "You cannot exit your square!"; close2; warp "pvp_n_4-5",68,99; end; } - script EmpBrk#3 -1,{ OnTimer5000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"Get ready to break the Emperium!",bc_area; end; OnTimer8000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"5",bc_area; end; OnTimer9000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"4",bc_area; end; OnTimer10000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"3",bc_area; end; OnTimer11000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"2",bc_area; end; OnTimer12000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"1",bc_area; end; OnTimer13000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"GO!!!",bc_area; monster "pvp_n_4-5",.xe,.ye,"Emperium",EMPELIUM,1,"EmpBrk#3::OnEmpBreak"; end; OnTimer600000: warpchar "prontera",156,191,$@empbrk_charid[2]; killmonster "pvp_n_4-5","EmpBrk#3::OnEmpBreak"; set $@empr_occupied[2],0; stopnpctimer; end; OnEmpBreak: stopnpctimer; set .current_time,getnpctimer(0,"EmpBrk#3"); set .new_time,.current_time - 13000; if (.new_time < empbrk_record || empbrk_record == 0) { areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"New Own Record!!!",bc_area; set empbrk_record,.new_time; } if (.new_time < $empbrk_record || $empbrk_record == 0) { announce strcharinfo(0)+" is now the new No. 1 Emperium Breaker!!",bc_all; set $empbrk_record,.new_time; set $empbrk_master$,strcharinfo(0); } set .m,.new_time / 60000; set .s,.new_time / 1000; set .ms,.new_time / 10000; if(.m < 0){ set .m,0; } if(.s < 0){ set .s,0; } areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"Your time is "+.m+"m "+.s+"s "+.ms+"ms",bc_area; warpchar "prontera",156,191,$@empbrk_charid[2]; set $@empr_occupied[2],0; end; OnInit: set .x1,94; set .y1,60; set .x2,105; set .y2,71; set .xe,99; set .ye,65; end; } pvp_n_4-5,100,74,0 script EmpBrk#3_touch FAKE_NPC,3,1,{ OnTouch: mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "You cannot exit your square!"; close2; warp "pvp_n_4-5",100,68; end; } - script EmpBrk#4 -1,{ OnTimer5000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"Get ready to break the Emperium!",bc_area; end; OnTimer8000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"5",bc_area; end; OnTimer9000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"4",bc_area; end; OnTimer10000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"3",bc_area; end; OnTimer11000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"2",bc_area; end; OnTimer12000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"1",bc_area; end; OnTimer13000: areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"GO!!!",bc_area; monster "pvp_n_4-5",.xe,.ye,"Emperium",EMPELIUM,1,"EmpBrk#4::OnEmpBreak"; end; OnTimer600000: warpchar "prontera",156,191,$@empbrk_charid[3]; killmonster "pvp_n_4-5","EmpBrk#4::OnEmpBreak"; set $@empr_occupied[3],0; stopnpctimer; end; OnEmpBreak: stopnpctimer; set .current_time,getnpctimer(0,"EmpBrk#4"); set .new_time,.current_time - 13000; if (.new_time < empbrk_record || empbrk_record == 0) { areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"New Own Record!!!",bc_area; set empbrk_record,.new_time; } if (.new_time < $empbrk_record || $empbrk_record == 0) { announce strcharinfo(0)+" is now the new No. 1 Emperium Breaker!!",bc_all; set $empbrk_record,.new_time; set $empbrk_master$,strcharinfo(0); } set .m,.new_time / 60000; set .s,.new_time / 1000; set .ms,.new_time / 10000; if(.m < 0){ set .m,0; } if(.s < 0){ set .s,0; } areaannounce "pvp_n_4-5",.x1,.y1,.x2,.y2,"Your time is "+.m+"m "+.s+"s "+.ms+"ms",bc_area; warpchar "prontera",156,191,$@empbrk_charid[3]; set $@empr_occupied[3],0; end; OnInit: set .x1,128; set .y1,94; set .x2,139; set .y2,105; set .xe,134; set .ye,99; end; } pvp_n_4-5,125,100,0 script EmpBrk#4_touch FAKE_NPC,1,3,{ OnTouch: mes "[ ^FF0000Emperium Breaker^000000 ]"; mes "You cannot exit your square!"; close2; warp "pvp_n_4-5",130,99; end; } pvp_n_4-5 mapflag nowarp 20 pvp_n_4-5 mapflag nowarpto 20 pvp_n_4-5 mapflag notrade 20 pvp_n_4-5 mapflag nochat 20 pvp_n_4-5 mapflag nocommand 20 pvp_n_4-5 mapflag novending 20 pvp_n_4-5 mapflag gvg_castle 20 pvp_n_4-5 mapflag nobranch 20 pvp_n_4-5 mapflag noicewall 20 pvp_n_4-5 mapflag noloot 20 pvp_n_4-5 mapflag nomemo 20 pvp_n_4-5 mapflag nosave 20 pvp_n_4-5 mapflag noreturn 20 pvp_n_4-5 mapflag gvg 20 //DUPLICATES Emperium Breaker 4_M_JOB_ASSASSIN //payon,170,220,4 duplicate(Emperium Breaker) Emperium Breaker#pay 4_M_JOB_ASSASSIN //gonryun,153,112,4 duplicate(Emperium Breaker) Emperium Breaker#gon 4_M_JOB_ASSASSIN Edited April 7, 2020 by ThyroDree Quote Share this post Link to post Share on other sites
0 meko 170 Posted April 7, 2020 By two more zeroes do you mean zero-padding so that the numbers are in the same format, like 008 (always the same width)? You can do zero-padding with sprintf() like so: sprintf("%03d", 5); // 005 so you would use it like this: mesf("^0000FFTime Taken^000000: [ %d.%03d Sec. ]", @emp_s, @emp_ms); // this would print, for example: Time taken: [ 5.095 Sec.] Quote Share this post Link to post Share on other sites
0 ThyroDree 3 Posted April 7, 2020 50 minutes ago, meko said: By two more zeroes do you mean zero-padding so that the numbers are in the same format, like 008 (always the same width)? You can do zero-padding with sprintf() like so: sprintf("%03d", 5); // 005 sprintf("%03d", 5); // 005 so you would use it like this: mesf("^0000FFTime Taken^000000: [ %d.%03d Sec. ]", @emp_s, @emp_ms); // this would print, for example: Time taken: [ 5.095 Sec.] mesf("^0000FFTime Taken^000000: [ %d.%03d Sec. ]", @emp_s, @emp_ms); // this would print, for example: Time taken: [ 5.095 Sec.] Yes adding more zeroes, like that. How can i use the sprintf and mesf to work in this script. I tried adding it to the script. Also searched for sprintf and mesf at herc.ws Quote Share this post Link to post Share on other sites
0 meko 170 Posted April 7, 2020 mesf(format, ...param) is just a shorthand for mes(sprintf(format, ...param)) so you don't have to use both mesf() and sprintf(). You can find the documentation in doc/script_commands.txt: mesf(), sprintf() Replace this line: mes "^FF0000Your Latest Record^000000: "+.@s+"."+.@ms+" Seconds."; With this line: mesf("^FF0000Your Latest Record^000000: %d.%03d Seconds.", .@s, .@ms); Replace this line: mes "^0000FFTime Taken^000000: [ "+.@emp_s+"."+.@emp_ms+" Sec. ]"; With this line: mesf("^0000FFTime Taken^000000: [ %d.%03d Sec. ]", .@emp_s, .@emp_ms); For the areaannounce() lines you can use sprintf(), like this: areaannounce("map name", .x1, .y1, .x2, .y2, sprintf("Your time is %dm %02ds %03dms", .m, .s, .ms), bc_area); Quote Share this post Link to post Share on other sites
0 ThyroDree 3 Posted April 8, 2020 10 hours ago, meko said: mesf(format, ...param) is just a shorthand for mes(sprintf(format, ...param)) so you don't have to use both mesf() and sprintf(). You can find the documentation in doc/script_commands.txt: mesf(), sprintf() Replace this line: mes "^FF0000Your Latest Record^000000: "+.@s+"."+.@ms+" Seconds."; mes "^FF0000Your Latest Record^000000: "+.@s+"."+.@ms+" Seconds."; With this line: mesf("^FF0000Your Latest Record^000000: %d.%03d Seconds.", .@s, .@ms); mesf("^FF0000Your Latest Record^000000: %d.%03d Seconds.", .@s, .@ms); Replace this line: mes "^0000FFTime Taken^000000: [ "+.@emp_s+"."+.@emp_ms+" Sec. ]"; mes "^0000FFTime Taken^000000: [ "+.@emp_s+"."+.@emp_ms+" Sec. ]"; With this line: mesf("^0000FFTime Taken^000000: [ %d.%03d Sec. ]", .@emp_s, .@emp_ms); mesf("^0000FFTime Taken^000000: [ %d.%03d Sec. ]", .@emp_s, .@emp_ms); For the areaannounce() lines you can use sprintf(), like this: areaannounce("map name", .x1, .y1, .x2, .y2, sprintf("Your time is %dm %02ds %03dms", .m, .s, .ms), bc_area); areaannounce("map name", .x1, .y1, .x2, .y2, sprintf("Your time is %dm %02ds %03dms", .m, .s, .ms), bc_area); Thank you will check on this. Quote Share this post Link to post Share on other sites
Hello how can I add 2 more zeroes to ms? also can add 5 top breakers not only the fastest one?
heres the script im using..
Share this post
Link to post
Share on other sites