Hi!

This might not be the best solution, but this is how I handle such stuff:
Code:
var total_str = 0;

STRING *list_str[999];

void add_to_str(STRING *str){
	
	list_str[total_str] = str_create(str);
	total_str++;
	
}

void test_list(scancode){
	
	if(scancode == 2){ add_to_str("EUR"); }
	if(scancode == 3){ add_to_str("USD"); }
	if(scancode == 4){ add_to_str("AUD"); }
	
}

void main(){
	
	on_1 = test_list; // add EUR to list
	on_2 = test_list; // add USD to list
	on_3 = test_list; // add AUD to list
	
	int i = 0;
	
	while(!key_esc){
		
		// show total amount of strings
		DEBUG_VAR(total_str, 10);
		
		// cycle through all list and show it's elements
		for(i = 0; i < total_str; i++){
			
			draw_text(list_str[i], 10, 30 + 20 * i, COLOR_WHITE);
			
		}
		
		wait(1);
		
	}
	
}



Best regards!

Edit: or version with a structure, so you could create lists:
Code:
typedef struct {
	
	var array_size;	
	STRING *str[999];
	
} LIST;

LIST *currency;

void add_to_str(LIST *pointer, STRING *str){
	
	pointer->str[pointer->array_size] = str_create(str);
	pointer->array_size++;
	
}

void test_currency(scancode){
	
	if(!currency){ currency = sys_nxalloc(sizeof(LIST)); }
	
	if(scancode == 2){ add_to_str(currency, "EUR"); }
	if(scancode == 3){ add_to_str(currency, "USD"); }
	if(scancode == 4){ add_to_str(currency, "AUD"); }
	
}

void main(){
	
	on_1 = test_currency; // add EUR to list
	on_2 = test_currency; // add USD to list
	on_3 = test_currency; // add AUD to list
	
	int i = 0;
	
	while(!key_esc){
		
		// if currency exist ?
		if(currency){
			
			// show total amount of strings
			DEBUG_VAR(currency->array_size, 10);
			
			// cycle through all list and show it's elements
			for(i = 0; i < currency->array_size; i++){
				
				draw_text(currency->str[i], 10, 30 + 20 * i, COLOR_WHITE);
				
			}
			
		}
		
		wait(1);
		
	}
	
}

It would be cool to add initialisation inside of the 'add_to_str' function, but I couldn't get it working..


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung