Jump to content
  • 0
Sign in to follow this  
Zirius

using functions inside select() rather than predetermined string

Question

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!

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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

.@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;}

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.