1
Request / Suggestion : A clear deck screenshot save
« on: November 20, 2017, 07:50:03 AM »
I am one of the person work for the CFA chinese patch updata. I think the deck screenshot can be better with the below code.(the F9 screenshot is not good enough)
[put the code into an object's step event in the deck edit room]
______________________________________________________________
if(keyboard_check(vk_shift) and keyboard_check_pressed(vk_space)){
var _sf;
_sf = surface_create(600, 88*7);
surface_set_target(_sf);
draw_clear_alpha(c_white, 0);
var _listEx, _listG3, _listG2, _listG1, _listG0;
_listEx = ds_list_create();
_listG3 = ds_list_create();
_listG2 = ds_list_create();
_listG1 = ds_list_create();
_listG0 = ds_list_create();
ds_list_copy(_listEx, global.DefaultDeckEx)
ds_list_sort(_listEx, 1);
var _n;
_n = ds_list_size(_listEx);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listEx, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_i mod 10), 43+88*(_i div 10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_i mod 10), 43+88*(_i div 10));
}
}
var _n;
_n = ds_list_size(global.DefaultDeck);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(global.DefaultDeck, _i);
if(global.UnitGrade[_cardNumber] == 3){
ds_list_add(_listG3, _cardNumber);
}else if(global.UnitGrade[_cardNumber] == 2){
ds_list_add(_listG2, _cardNumber);
}else if(global.UnitGrade[_cardNumber] == 1){
ds_list_add(_listG1, _cardNumber);
}else if(global.UnitGrade[_cardNumber] == 0){
ds_list_add(_listG0, _cardNumber);
}
}
ds_list_sort(_listG3, 1);
ds_list_sort(_listG2, 1);
ds_list_sort(_listG1, 1);
ds_list_sort(_listG0, 1);
var _ex;
_ex = ds_list_size(global.DefaultDeckEx);
var _count;
_count = 0;
// G3
var _n;
_n = ds_list_size(_listG3);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listG3, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}
_count += 1;
}
// G2
var _n;
_n = ds_list_size(_listG2);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listG2, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}
_count += 1;
}
// G1
var _n;
_n = ds_list_size(_listG1);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listG1, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}
_count += 1;
}
// G0
var _n;
_n = ds_list_size(_listG0);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listG0, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}
_count += 1;
}
ds_list_destroy(_listEx);
ds_list_destroy(_listG3);
ds_list_destroy(_listG2);
ds_list_destroy(_listG1);
ds_list_destroy(_listG0);
surface_save(_sf, string(date_get_year(date_current_datetime()))+string(date_get_month(date_current_datetime()))+string(date_get_day(date_current_datetime()))+string(date_get_hour(date_current_datetime()))+string(date_get_minute(date_current_datetime()))+string(date_get_second(date_current_datetime()))+'.png');
surface_reset_target();
surface_free(_sf);
}
______________________________________________________________
Then, Cfa player can pressed [shift + space] to get a deck screenshot picture with only 16 Exdeck cards and 50 Deck cards by sorting. I think it would be useful, if player want to get a deck screenshot picture for communication.
[The code is a sample ]
[put the code into an object's step event in the deck edit room]
______________________________________________________________
if(keyboard_check(vk_shift) and keyboard_check_pressed(vk_space)){
var _sf;
_sf = surface_create(600, 88*7);
surface_set_target(_sf);
draw_clear_alpha(c_white, 0);
var _listEx, _listG3, _listG2, _listG1, _listG0;
_listEx = ds_list_create();
_listG3 = ds_list_create();
_listG2 = ds_list_create();
_listG1 = ds_list_create();
_listG0 = ds_list_create();
ds_list_copy(_listEx, global.DefaultDeckEx)
ds_list_sort(_listEx, 1);
var _n;
_n = ds_list_size(_listEx);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listEx, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_i mod 10), 43+88*(_i div 10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_i mod 10), 43+88*(_i div 10));
}
}
var _n;
_n = ds_list_size(global.DefaultDeck);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(global.DefaultDeck, _i);
if(global.UnitGrade[_cardNumber] == 3){
ds_list_add(_listG3, _cardNumber);
}else if(global.UnitGrade[_cardNumber] == 2){
ds_list_add(_listG2, _cardNumber);
}else if(global.UnitGrade[_cardNumber] == 1){
ds_list_add(_listG1, _cardNumber);
}else if(global.UnitGrade[_cardNumber] == 0){
ds_list_add(_listG0, _cardNumber);
}
}
ds_list_sort(_listG3, 1);
ds_list_sort(_listG2, 1);
ds_list_sort(_listG1, 1);
ds_list_sort(_listG0, 1);
var _ex;
_ex = ds_list_size(global.DefaultDeckEx);
var _count;
_count = 0;
// G3
var _n;
_n = ds_list_size(_listG3);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listG3, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}
_count += 1;
}
// G2
var _n;
_n = ds_list_size(_listG2);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listG2, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}
_count += 1;
}
// G1
var _n;
_n = ds_list_size(_listG1);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listG1, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}
_count += 1;
}
// G0
var _n;
_n = ds_list_size(_listG0);
var _i;
for(_i=0; _i<_n; _i+=1){
var _cardNumber;
_cardNumber = ds_list_find_value(_listG0, _i);
if(global.CardLoadMini[_cardNumber] == 1){
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}else{
global.SpriteUseMini[_cardNumber] = sprite_add('CardSpriteMini/n'+string(_cardNumber)+'.jpg', 1, 0, 0, 30, 43);
global.CardLoadMini[_cardNumber] = 1;
draw_sprite(global.SpriteUseMini[_cardNumber], 0, 30+60*(_count mod 10), 43+88*(_count div 10)+88*ceil(_ex/10));
}
_count += 1;
}
ds_list_destroy(_listEx);
ds_list_destroy(_listG3);
ds_list_destroy(_listG2);
ds_list_destroy(_listG1);
ds_list_destroy(_listG0);
surface_save(_sf, string(date_get_year(date_current_datetime()))+string(date_get_month(date_current_datetime()))+string(date_get_day(date_current_datetime()))+string(date_get_hour(date_current_datetime()))+string(date_get_minute(date_current_datetime()))+string(date_get_second(date_current_datetime()))+'.png');
surface_reset_target();
surface_free(_sf);
}
______________________________________________________________
Then, Cfa player can pressed [shift + space] to get a deck screenshot picture with only 16 Exdeck cards and 50 Deck cards by sorting. I think it would be useful, if player want to get a deck screenshot picture for communication.
[The code is a sample ]