Jump to content
  • 0

Lottery Script Error


Dolphin86

Question


  • Group:  Members
  • Topic Count:  253
  • Topics Per Day:  0.06
  • Content Count:  701
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

Error:

1.PNG.93b1d6b0eeafb8b581b19d050a7a67e6.PNG

Script:

Click Here

Help please..

Edited by Dolphin86
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  155
  • Reputation:   51
  • Joined:  07/15/13
  • Last Seen:  

chry_fld,144,48,5	script	Gatcha Vending	562,{

	mes "[Gatcha  Ticket Vending]";
	mes "Use your Gatcha Ticket here.";
	next;
	switch(select("- Use:- See possibility:- Exit"))
	{
		case 1:		
			if ( !countitem(.itemuse) ) {
			mes "[Gatcha  Ticket Vending]";
			mes "A "+ getitemname(.itemuse) +" is needed to use this machine";
			close;
			}
			delitem .itemuse, 1;
			getitem .temp_array[rand(0, getarraysize(.temp_array))], 1;
			end;
		case 2:
			next;
			mes "[Gatcha  Ticket Vending]";
			mes "Select possibility.";
			switch(select("- High Chance:- Mid Chance:- Low Chance:- Exit")){
			
				case 1:
					next;
					mes "[Gatcha  Ticket Vending]";
					mes F_MesItemInfo(14003);
					mes F_MesItemInfo(40021);
					mes F_MesItemInfo(40028);
					mes F_MesItemInfo(40026);
					end;
				case 2:
					next;
					mes "[Gatcha  Ticket Vending]";
					mes F_MesItemInfo(40030);
					mes F_MesItemInfo(40031);
					mes F_MesItemInfo(40039);
					mes F_MesItemInfo(40040);
					end;
					
				case 3:
					mes "[Gatcha  Ticket Vending]";
					mes F_MesItemInfo(40001);
					mes F_MesItemInfo(40033);
					mes F_MesItemInfo(40035);
					mes F_MesItemInfo(40041);
					mes F_MesItemInfo(40042);
					end;
					
				case 4:
					next;
					mes "[Gatcha  Ticket Vending]";
					mes "Good Bye.";
					close;
			}
			
	}
	
OnInit:
	waitingroom "Gatcha Pot",0,0;
	.itemuse = 40022; 
	setarray .itemid[0], 14003,40021,40028,40026,40030,40031,40039,40040,40001,40033,40035,40041,40042;
	setarray .itemchance[0], 90,90,90,90,70,70,70,70,10,10,10,10,10;
	
	freeloop(1);
	.@counter = 0;
	for(.@i = 0; .@i < getarraysize(.itemid); .@i++) {
		for(.@k = 0; .@k < .itemchance[.@i]; .@k++) {
			.temp_array[.@counter] = .itemid[.@i];
			.@counter++;
		}
	}
	freeloop(0);
	end;
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  253
  • Topics Per Day:  0.06
  • Content Count:  701
  • Reputation:   16
  • Joined:  01/07/12
  • Last Seen:  

11 hours ago, EIysium said:
chry_fld,144,48,5	script	Gatcha Vending	562,{

	mes "[Gatcha  Ticket Vending]";
	mes "Use your Gatcha Ticket here.";
	next;
	switch(select("- Use:- See possibility:- Exit"))
	{
		case 1:		
			if ( !countitem(.itemuse) ) {
			mes "[Gatcha  Ticket Vending]";
			mes "A "+ getitemname(.itemuse) +" is needed to use this machine";
			close;
			}
			delitem .itemuse, 1;
			getitem .temp_array[rand(0, getarraysize(.temp_array))], 1;
			end;
		case 2:
			next;
			mes "[Gatcha  Ticket Vending]";
			mes "Select possibility.";
			switch(select("- High Chance:- Mid Chance:- Low Chance:- Exit")){
			
				case 1:
					next;
					mes "[Gatcha  Ticket Vending]";
					mes F_MesItemInfo(14003);
					mes F_MesItemInfo(40021);
					mes F_MesItemInfo(40028);
					mes F_MesItemInfo(40026);
					end;
				case 2:
					next;
					mes "[Gatcha  Ticket Vending]";
					mes F_MesItemInfo(40030);
					mes F_MesItemInfo(40031);
					mes F_MesItemInfo(40039);
					mes F_MesItemInfo(40040);
					end;
					
				case 3:
					mes "[Gatcha  Ticket Vending]";
					mes F_MesItemInfo(40001);
					mes F_MesItemInfo(40033);
					mes F_MesItemInfo(40035);
					mes F_MesItemInfo(40041);
					mes F_MesItemInfo(40042);
					end;
					
				case 4:
					next;
					mes "[Gatcha  Ticket Vending]";
					mes "Good Bye.";
					close;
			}
			
	}
	
OnInit:
	waitingroom "Gatcha Pot",0,0;
	.itemuse = 40022; 
	setarray .itemid[0], 14003,40021,40028,40026,40030,40031,40039,40040,40001,40033,40035,40041,40042;
	setarray .itemchance[0], 90,90,90,90,70,70,70,70,10,10,10,10,10;
	
	freeloop(1);
	.@counter = 0;
	for(.@i = 0; .@i < getarraysize(.itemid); .@i++) {
		for(.@k = 0; .@k < .itemchance[.@i]; .@k++) {
			.temp_array[.@counter] = .itemid[.@i];
			.@counter++;
		}
	}
	freeloop(0);
	end;
}

 

your the best @Elysium but question, what was wrong actually?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  155
  • Reputation:   51
  • Joined:  07/15/13
  • Last Seen:  

11 hours ago, Dolphin86 said:

your the best @Elysium but question, what was wrong actually?

I just add freeloop(1); and freeloop(0) before and after on .@counter = 0 part.

Link to comment
Share on other sites

  • 0

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

actually, you can also consider another alternative like this

	.size = getarraysize(.itemid);
	for (.@i = 0; .@i < .size; .@i++)
		.total_chance += .itemchance[.@i];
.@rate = rand(.total_chance);
for (.@i = 0; .@i < .size; .@i++) {
	.@total_itemchance += .itemchance[.@i];
	if (.@rate < .@total_itemchance) {
		getitem .itemid[.@i], 1;
		end;
	}
}

this would greatly reduce your array size, and probably perform slightly better

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