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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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