Jump to content
  • 0

obtain randomly instead of chronologically ordered


kalabasa

Question


  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

if ( abcde < 4 )
			abcde++;
		for ( .@i = 0; .@i < abcde; .@i++ )
			.@form$ = .@form$ + .word$[.@i] +" ";
		for ( .@i = abcde; .@i < 4; .@i++ )
			.@form$ = .@form$ +"_ ";
		message strcharinfo(0), "Letter's Collected : "+ .@form$;

instead of collecting chronologically at random % how to change it to obtain the letters randomly

 

PS: i dont know what to put into the tittle . to the moderators kindly edit it thanks!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

you could try something like this.

initialize all the character as specific character, then search and replace them randomly.

if (abcde$ == "")
	abcde$ = "____"; // initialize with a dummy character

if (compare(abcde$, "_")) {
	.@length = getstrlen(abcde$);
	do {
		.@index = rand(.@length);
	} while (charat(abcde$, .@index) != "_")); // search for it
	setchar(abcde$, .word$[.@index], .@index); // replace it
}
message strcharinfo(0), "Letter's Collected : "+ abcde$;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

its working but it wont let me show the letters that i obtained

it will show only Letter's Collected: _____

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

if (abcde$ == "")
	abcde$ = "____"; // initialize with a dummy character

if (compare(abcde$, "_")) {
	.@length = getstrlen(abcde$);
	do {
		.@index = rand(.@length);
	} while (charat(abcde$, .@index) != "_"); // search for it
	abcde$ = setchar(abcde$, .word$[.@index], .@index); // replace it
}
message strcharinfo(0), "Letter's Collected : "+ abcde$;
end;

jbtafYu.png

Edited by Emistry
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

i did try to add more letters on it. but it can only display up to 4 letters.

i still cant find where did i got the script for the source.

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...