• 0
Sign in to follow this  
astralprojection

Pick item from array

Question

-	script	test	-1,{
	setarray([email protected], <pick 10 items from [email protected][1]);
	mes("Your missions are;");
	mes("Mission 1: "[email protected][1];
	mes("Mission 2: "[email protected][2];
	mes("Mission 3: "[email protected][3];
	mes("Mission 4: "[email protected][4];
	mes("Mission 5: "[email protected][5];
	mes("Mission 6: "[email protected][6];
	mes("Mission 7: "[email protected][7];
	mes("Mission 8: "[email protected][8];
	mes("Mission 9: "[email protected][9];
	mes("Mission 10: "[email protected][10];
	close();
	
OnInit:
	setarray([email protected][1],50001,50002,50003,50004,50005,50006,50007,50008,50009,50010,50011,50012,50013,50014,50015,50016,50017);
	end;

To the script Guru out there :D

can i ask help on this to pick 10 random items from array with no duplicate and create new array on the picked items?
 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

https://github.com/AnnieRuru/Release/blob/master/Guides/Shuffle Algorithm.md

prontera,157,180,4	script	Option Master	4_DOG01,{
	mes "Your missions are;";
	F_ShuffleNumbers 0, .size -1, .@r, 10;
	for ( .@i = 0; .@i < 10; ++.@i )
		mesf "Mission %d: %d", .@i +1, .mission[.@r[.@i]];
	close;
OnInit:
	for ( .@i = 1; .@i <= 17; ++.@i )
		.mission[.@i -1] = .@i + 50000;
	.size = getarraysize(.mission);
	end;
}

 

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.   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.

Loading...
Sign in to follow this