Jump to content

Question

Posted

Hi all ^^'

 

I need to create a function that does the same as the vendings: each amount of Zeny has a specific color.

 

The problem is not to create the function, but to know the relationship between the amount of zeny and its color.

 

Any help will be very well received ^^'

 

Att,

CaioVictor.

11 answers to this question

Recommended Posts

Posted


if( Zeny < 1000 ) set .@color$,"^FF0000";

else if( Zeny < 1000000 ) set .@color$,"^0055FF";

else if( Zeny < 1000000000 ) set .@color$,"^00EE00";

else set .@color$,"^FFFFFF";

mes "Zeny :"+.@color$+" "+Zeny+"^000000";

close;

Posted

Like that?

prontera,155,180,0	script	color	100,{
function color; function Step; function int__;

	mes color( 999 );
	mes color( 1000 );
	mes color( 10000 );
	mes color( 100000 );
	mes color( 1000000 );
	close;

function color {
	.@tmp = getarg(0);
	.@value$ = int__( .@tmp );
	while( .@i < .size && .@tmp < .step_value[.@i] ) .@i++;
	if ( .@i == .size ) .@i--;
	return ( ( .@tmp < .step_value[.size-1] ? "" : .color_value$[.@i] ) + .@value$ + "^000000" );
}
function int__ {
	.@value$ = getarg(0);
	for ( .@i = .@j = getstrlen( .@value$ ); .@i > 0; .@i-- )
		.@string$ = charat( .@value$, .@i -1 ) + ( ( .@j - .@i ) && ( .@j - .@i )%3 == 0 ? "," : "" ) + .@string$;
	return .@string$;
}
function Step {
	.step_value[.size] = getarg(0);
	.color_value$[.size] = getarg(1);
	.size++;
}
OnInit:
// Step zeny desc
	Step( 1000000, "^ff0000" );
	Step( 100000, "^ffff00" );
	Step( 10000, "^00ff00" );
	Step( 1000, "^0000ff" );
}
Posted (edited)

I was going to try my hand at this but ended up doing something completely different... I'll post it anyways. Lawl.

prontera,151,151,0	script	GirlyGirl	719,{

mes "[GirlyGirl]";

mes "I can count to ten watch!";

explode(.@array$,callfunc("F_Numbers","One Two 3, 5 77 89 143,039,011")," ");

while(.@array$[(.@a++-1)]!=""){

sleep2 500;

mes .@array$[.@a-1];

} emotion e_what,0;

mes "... What was I doing again?";

sleep2 500;

emotion e_swt,0;

close;

OnInit:

setarray $@colors$[0],"^78c5d6","^459ba8","^79c267","^c5d647","^f5d63d",

"^f28c33","^e868a2","^bf62a6","^6645bf","^fe2020",

"^7b61bf";

}

function script F_Numbers {

set .@arg$,getarg(0);

explode(.@eles$,.@arg$," ");

set .@clen,getarraysize($@colors$);

while(.@eles$[.@k]!="") {

set .@len,getstrlen(.@eles$[.@k]);

for(set(.@z,0);.@z<.@len;set(.@z,.@z+1)) {

set .@str$, charat(.@eles$[.@k],.@z);

setarray .@b[.@z], pow(2,atoi(.@str$));

for(set .@a,(.@clen-1); .@a > 0; set .@a,.@a - 1) {

if((.@b[.@z] % pow(2,.@a)) != ((.@b[.@z]==1)?((.@a==(.@clen-1))?0:1):.@b[.@z])) {

set .@return$[.@k],.@return$[.@k] + $@colors$[.@a] + .@str$ + "^000000";

set .@b[.@z],.@b[.@z] % pow(2,.@a);

}

}

}

set .@k,.@k+1;

}

return implode(.@return$," ");

}

Edit: Posted better example of the function. Edited by Skorm
Posted

Hi Skorm ^^'

 

Thanks for answer me too xD

 

create a list with prices and their colors ^^'

 

i4d5.jpg

 

Now i need to extract the exact colors for each step of price xD

 

But there is a problem, for example, to "1z" the image shows a dark green, but if you try to copy the color you will see that is black =\
 

Does anyone have a list of the exact colors in RGB?

 

Thanks again for helping me!

 

Att,

CaioVictor.

Posted

What I do not understand is why some colors have shade!

Can we do this on npcs?

 

Att,

CaioVictor.

 

To my knowledge this cannot be replicated via current NPC commands.

 

You might get a similar effect with the setfont command. I've never used it before so I'm not sure.

*setfont <font>;

This command sets the current RO client interface font to one of the
fonts stored in data\*.eot by using an ID of the font. When the ID
of the currently used font is used, default interface font is used
again.

    0 - Default
    1 - RixLoveangel
    2 - RixSquirrel
    3 - NHCgogo
    4 - RixDiary
    5 - RixMiniHeart
    6 - RixFreshman
    7 - RixKid
    8 - RixMagic
    9 - RixJJangu
Posted

Interesting!


I did not know this "setfont", but I will test it.

I'm questioning these things, because I can't find any color that looks similar to
those who have shade =\

 

Att,

CaioVictor.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...