using functions inside select() rather than predetermined string

Zirius

New member
Messages
261
Points
0
hello, I am currently using the snippet:

switch(select(gettime(6),(gettime(6)+1),(gettime(6)+2))){ case 1: .@month = gettime(6); break; case 2: .@month = (gettime(6)+1); break; case 3: .@month = (gettime(6)+2); break;}
As you can see, I am using function that returns an integer inside a select() function, it works great, except that console keeps showing debug at console because ofc select requires string

[Warning]: Unexpected type for argument 1. Expected string.
[Debug]: Data: number value=2
[Debug]: Function: select
is there a way I can convert those gettime() into a string so I can use it inside select() function without showing debug errors?

Thank you!

 
You can try to make the string in a npc variable. What about this:
 

Code:
.@i$ = gettime(6)+":"+(gettime(6)+1)+":"+(gettime(6)+2);switch(select(.@i$)){    case 1:   	 .@month = gettime(6);   	 break;    case 2:        .@month = (gettime(6)+1);        break;    case 3:        .@month = (gettime(6)+2);        break;}
 
Back
Top