I don't usually publicly ask for assistance, but I figure that such a script could inspire others with their own creations if I did ask for support on this publicly.
In this script, I want players to earn temporary "value" points that get stored in an SQL table (or a global array) along with their character ID. In this particular example, a GM must enable the sorting mechanism, but in the final iteration it will be automatically called upon by an external script via "donpcevent "Ides Sort::OnSort";" which will then run an SQL query that orders the players with the highest "value" in descending order and warps the results into two places in a 1 2 1 2 1 2 1 2 fashion. This is to essentially provide as much balance as possible for a PVP-based event.
The problem I face presently is that the script is not teleporting players past a certain point, and at times does not even make it past the "for" loop to reach the truncate queries and erasing the array and temporary global variables.
The console shows no errors, and even when the script runs, no errors display.
What I'm requesting is the script's sorting feature at the very least, to be optimized and changed to allow it to work. If players are offline when it activates, it simply skips over them and continues sorting the remaining players.
If anyone can assist with this, I'd be most grateful as this has been trying my nerves for the greater portion of the past 48 hours.
ides01,100,144,0 script Ides Sort -1,5,5,{
if(getgroupid() >= 95) {
mes "Continue Sort?";
next;
menu "Yes",-;
close2;
donpcevent "Ides Sort::OnSort";
end; }
if(idessorted < 1) {
warp "ides01",
set idessorted,1;
set .@char_id,getcharid(0);
// Value 1-10 for Base Level
if(BaseLevel < 70) { set .@value,.@values+1;}
if(BaseLevel >= 70 && BaseLevel < 80) { set .@value,.@values+2;}
if(BaseLevel >= 80 && BaseLevel < 90) { set .@value,.@values+3;}
if(BaseLevel >= 90 && BaseLevel < 100) { set .@value,.@values+4;}
if(BaseLevel >= 100 && BaseLevel < 110) { set .@value,.@values+5;}
if(BaseLevel >= 110 && BaseLevel < 120) { set .@value,.@values+6;}
if(BaseLevel >= 120 && BaseLevel < 130) { set .@value,.@values+7;}
if(BaseLevel >= 130 && BaseLevel < 140) { set .@value,.@values+8;}
if(BaseLevel >= 140 && BaseLevel < 150) { set .@value,.@values+9;}
if(BaseLevel == 150) { set .@value,.@values+10;}
set .@value,.@value+BaseLevel;
// Class Points Based On
if(Class >= 0 && Class <= 25 || Class >= 4046 && Class <= 4049) { set .@value,.@value+0;} // First Jobs & Extended Jobs
if(Class >= 4001 && Class <= 4022) { set .@value,.@value+10;} // Trans Classes
if(Class >= 4023 && Class <= 4045) { set .@value,.@value+0;} // Baby First/Second Jobs
if(Class >= 4054 && Class <= 4087) { set .@value,.@value+25;} // 3rd Jobs
if(Class >= 4096 && Class <= 4112) { set .@value,.@value+15;} // Baby 3rd Jobs
if(Class >= 4211) { set .@value,.@value+15;} // Kagerou/Oboro Place Holder
// Role Specific Values
query_sql("INSERT INTO `rune_rankings`.`ides_sorting` values ('"+.@char_id+"', '"+.@value+"')");
}
mes "Success";
close;
end;
OnSort:
set $@nb1, query_sql("SELECT char_id,value FROM `rune_rankings`.`ides_sorting` ORDER BY value DESC", $@char_id[1], $@value[1]);
set $@nb2,query_sql("SELECT COUNT(*) AS size FROM rune_rankings.ides_sorting", $@size);
for( set .@i, 0; .@i <= $@size; set .@i, .@i +1 ) {
if($ideswitch == 0) {
set $ideswitch,1;
warpchar "ides01",50,146,$@char_id[.@i];
goto L_skip;
}
set $ideswitch,0;
warpchar "ides01",154,146,$@char_id[.@i];
L_skip:
}
//mapannounce "ides01","[ides] Teams have been sorted!",0;
query_sql("TRUNCATE `rune_rankings`.`ides_sorting`");
deletearray $@char_id[0],$@size;
set $@nb2,0;
set $@size,0;
end;
}
3:20pm EST: Since I've not received any assistance on this yet, $10.00 USD via Paypal to whoever can get it working properly.
Question
jTynne
I don't usually publicly ask for assistance, but I figure that such a script could inspire others with their own creations if I did ask for support on this publicly.
In this script, I want players to earn temporary "value" points that get stored in an SQL table (or a global array) along with their character ID. In this particular example, a GM must enable the sorting mechanism, but in the final iteration it will be automatically called upon by an external script via "donpcevent "Ides Sort::OnSort";" which will then run an SQL query that orders the players with the highest "value" in descending order and warps the results into two places in a 1 2 1 2 1 2 1 2 fashion. This is to essentially provide as much balance as possible for a PVP-based event.
The problem I face presently is that the script is not teleporting players past a certain point, and at times does not even make it past the "for" loop to reach the truncate queries and erasing the array and temporary global variables.
The console shows no errors, and even when the script runs, no errors display.
What I'm requesting is the script's sorting feature at the very least, to be optimized and changed to allow it to work. If players are offline when it activates, it simply skips over them and continues sorting the remaining players.
If anyone can assist with this, I'd be most grateful as this has been trying my nerves for the greater portion of the past 48 hours.
3:20pm EST: Since I've not received any assistance on this yet, $10.00 USD via Paypal to whoever can get it working properly.
Link to comment
Share on other sites
4 answers to this question
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.