Jump to content
  • 0
almarket23

Code Creation Request

Question

prontera,150,150,5	script	codes	89,{set .@n$,"[Code Creator]";				mes .@n$;				mes "This code will only work with the help of the Administrator. Please give this code to our Administrator so that they can Reset your System Credential.";				next;				mes .@n$;				mes "Please write this down.";				mes "===================================";				next;					set .codesArray,rand(0,5);	if ( .codesArray == 0 ) {	setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; }	if ( .codesArray == 1 ) {	setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; }	if ( .codesArray == 2 ) {	setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; }	if ( .codesArray == 3 ) {	setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; }	if ( .codesArray == 4 ) {	setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; }	if ( .codesArray == 5 ) {	setarray .codes[1],A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8,9,0; }					set .GenerateCode1,.codes[rand(0,61)];				set .GenerateCode2,.codes[rand(0,61)];				set .GenerateCode3,.codes[rand(0,61)];				set .GenerateCode4,.codes[rand(0,61)];				set .GenerateCode5,.codes[rand(0,61)];				set .GenerateCode6,.codes[rand(0,61)];				set .GenerateCode7,.codes[rand(0,61)];				set .GenerateCode8,.codes[rand(0,61)];				set .GenerateCode9,.codes[rand(0,61)];				set .GenerateCode10,.codes[rand(0,61)];								mes .@n$;				mes "Please write this down.";				mes "===================================";				mes "Your Code is: "+.GenerateCode1+""+.GenerateCode2+""+.GenerateCode3+""+.GenerateCode4+""+.GenerateCode5+""+.GenerateCode6+""+.GenerateCode7+""+.GenerateCode8+""+.GenerateCode9+""+.GenerateCode10+"";				close;				}		}}

 

Can anyone fix this script for me please? I am creating an NPC that will generate a code.

The code is a combination of Capital, Small Letters and a number.

Thanks in advance for those who wants to help me...

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

I think this should work, didn't test it though

prontera,150,150,5	script	codes	89,{
set .@n$,"[code Creator]";
	mes .@n$;
	mes "This code will only work with the help of the Administrator. Please give this code to our Administrator so that they can Reset your System Credential.";
	next;
	mes .@n$;
	mes "Please write this down.";
	mes "===================================";
	for (.@i = 0; .@i< 10; .@i++) {
		.@ch$ = .codes$[rand(getarraysize(.codes$))];
		.@gen$[.@i] = (rand(2)?strtolower(.@ch$):.@ch$);
	}
	mes "Your Code is: " + implode(.@gen$);
	close;

OnInit:
	setarray .codes$[0],"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0";	end;}
Edited by Garr

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

×
×
  • Create New...

Important Information

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