Jump to content
  • 0

need help


lunawany88

Question


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  32
  • Reputation:   0
  • Joined:  10/27/12
  • Last Seen:  

can anyone help me.. im success crafting but the item dont have in my inventory... and one more thing i want the item random get this

1 piece silk mats-50%

2 piece silk mats-25%

3 piece silk mats-10%

4 piece silk mats-5%

this my script

prontera,156,172,4 script npc 757,{
function RequiredItems;
function ForgedList;
mes "What you are trying to Forge ?";
next;
switch( select( "Silk Mat", // case 1
 "Small Pocket Cottan", // case 2
 "Leather pouch", // case 3
 "Snake Skin", // case 4
 "Steel Plate", // case 5
 "Iron Plate",
 "Golden Thread")){  // last case...

Case 1:
RequiredItems( 7168,1,7217,1,914,5,7879,1 );
set .@i,ForgedList( 7051,1,7051,2,7051,3,7051,4 );
break;
//Case 4 or more...
default:
 mes "Configuration's Problems..";
 close;
}
mes "You gained 1 "+getitemname( .@i )+".";
close2;
emotion e_heh;
end;

function RequiredItems {
mes "[   ^0000FF  Required Items  ^000000   ]";
mes "^FFFFFF________________________________^000000";
for( set .@i,0; getarg( .@i,0 ); set .@i,.@i + 2 ){
 mes (( countitem( getarg( .@i ) ) < getarg( .@i + 1 ) )?"^FF0000":"^00FF00" )+"[ "+countitem( getarg( .@i ) )+" / "+getarg( .@i + 1 )+" ] ^0000FF "+getitemname( getarg( .@i ) )+"^000000";
 if( countitem( getarg( .@i ) ) < getarg( .@i + 1 ) )
  set .@InComplete,.@InComplete + 1;
}
mes "^FFFFFF________________________________^000000";
if( .@InComplete ){
 mes "[   ^FF0000InComplete^000000   ]	 ^FF0000"+.@InComplete+"^000000 Items ";
 close;
}
next;
mes "^FF0000Success Rate^000000 :";
mes "^FFFFFF________________________________^000000";
mes "1 item : 50%";
mes "2 item : 25%";
mes "3 item : 10%";
mes "4 item : 5%";
mes "^FFFFFF________________________________^000000";
mes "^FF0000Else...Fail..^000000";
next;
if( select("^FF0000Continue^000000:Cancel") == 2 ) close;
for( set .@i,0; getarg( .@i,0 ); set .@i,.@i + 2 )
 delitem getarg( .@i ),getarg( .@i + 1 );
return;
}
function ForgedList {
set .@Rate,rand( 200 );
// 5%
if( .@Rate < 5 ) return getarg(3);
// 15%
else if( .@Rate >= 5 && .@Rate < 15 ) return getarg(2);
// 10%
else if( .@Rate >= 15 && .@Rate < 40 ) return getarg(1);
// 50%
else if( .@Rate >= 40 && .@Rate < 90 ) return getarg(0);
//other...
else{
 mes "You ...Failed...";
 close;
}
}
}

Edited by Emistry
Please use [CODEBOX] or Attachments for long contents.
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

this script require 2-dimension array

prontera,156,181,5	script	asdas	100,{
mes "select an item";
next;
.@item = select( .menu$ );
mes "the item you chose = "+ getitemname( getd( ".craft"+ .@item +"[0]" ) );
mes "require the following items";
for ( .@i = 1; .@i < .size[ .@item ]; .@i += 2 )
	mes getd(".craft"+ .@item +"["+( .@i +1 )+"]") +"x "+ getitemname( getd(".craft"+ .@item +"["+ .@i +"]" ) );
next;
for ( .@i = 1; .@i < .size[ .@item ]; .@i += 2 ) {
	if ( countitem( getd(".craft"+ .@item +"["+ .@i +"]") ) < getd(".craft"+ .@item +"["+( .@i +1 )+"]") ) {
		.@not_enough[ .@c ] = getd(".craft"+ .@item +"["+ .@i +"]");
		.@c++;
	}
}
if ( .@c ) {
	mes "== Incomplete Items ==";
	for ( .@i = 0; .@i < .@c; .@i++ )
		mes getitemname( .@not_enough[ .@i ] );
	close;
}
for ( .@i = 1; .@i < .size[ .@item ]; .@i += 2 )
	delitem getd(".craft"+ .@item +"["+ .@i +"]" ), getd(".craft"+ .@item +"["+( .@i +1 )+"]");
.@rand = rand(100);
if ( .@rand < 5 ) .@get = 4;
else if ( .@rand < 10 ) .@get = 3;
else if ( .@rand < 25 ) .@get = 2;
else if ( .@rand < 50 ) .@get = 1;
else {
	mes "you failed at crafting this item";
	close;
}
getitem getd( ".craft"+ .@item +"[0]" ), .@get;
mes "you get "+ .@get +"x "+ getitemname( getd( ".craft"+ .@item +"[0]" ) );
close;

OnInit:
setarray .craft1, 1201, 501,1, 502,1, 503,1;
setarray .craft2, 1204, 504,1, 505,1, 506,1;
setarray .craft3, 2301, 512,1, 513,1, 514,1, 515,1;

for ( .@i = 1; getd(".craft"+ .@i ); .@i++ ) {
	.menu$ = .menu$ + getitemname( getd(".craft"+ .@i +"[0]") ) +":";
	.size[.@i] = getarraysize( getd(".craft"+ .@i ) ) -1;
}
end;
}

where the

x-axis is the require items

y-axis is the list of craft-able items in the menu

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

OnInit:
setarray .craft1, 1201, 501,1, 502,1, 503,1;
setarray .craft2, 1204, 504,1, 505,1, 506,1;
setarray .craft3, 2301, 512,1, 513,1, 514,1, 515,1;

Can arrays in rAthena be set without any initial index or dimension? O.o

for ( .@i = 1; getd(".craft"+ .@i ); .@i++ ) {

Can an existing array be checked about if empty or not just by calling the array name without any getarraysize command?

If so, wow about rAthena :o

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

OnInit:
setarray .craft1, 1201, 501,1, 502,1, 503,1;
setarray .craft2, 1204, 504,1, 505,1, 506,1;
setarray .craft3, 2301, 512,1, 513,1, 514,1, 515,1;

Can arrays in rAthena be set without any initial index or dimension? O.o

yes

in eathena/rathena, set .@var, 1; is equal to set .@var[0], 1;

because in our script engine , variable is equal to array with index [0]

for ( .@i = 1; getd(".craft"+ .@i ); .@i++ ) {

Can an existing array be checked about if empty or not just by calling the array name without any getarraysize command?

If so, wow about rAthena :o

yeah lol

getd(".craft"+ .@i )

here is equal to

if ( getd(".craft"+ .@i ) != 0 )

yeah I know rathena script engine sux ... ok ...

I've been get used to this with my experiences ...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

yeah lol

getd(".craft"+ .@i )

here is equal to

if ( getd(".craft"+ .@i ) != 0 )

I know this, but I mean...

getd(".craft"+ .@i ) actually is an array. So will it just check the first indexed value according to what you said before?

Btw, I'm asking those things even if knowing pretty well about IPL, shouldn't you be more clear with easier codes for members who's asking for help? How are them supposed to understand properly what you did if you highlight particular unnecessary constructions about rA, especially if they have no real experiences programming?

Link to comment
Share on other sites


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

getd(".craft"+ .@i ) actually is an array.

original...it's an array.....but during the checking...it only refer to the 1st index in the array.....mentioned in post#4

whenever there is a value inside getd(".craft"+ .@i ) ...during the condition checking..it will alway return true....unless the value stored inside the variable is 0...

If a variable was never set, it is considered to equal zero for integer

variables or an empty string ("", nothing between the quotes) for string

variables.

shouldn't you be more clear with easier codes for members who's asking for help?

sometime it's really hard when you try to script something "easy" to view by other when you already higher than that level....

i believe when writing a script, we usually look for an efficient way to do it...and not a "easy" way to view it...

when users search for help in script....i believe most of them have the basic to write / read from a script....

not to mention that Annie doesnt have any experiences of programming..LOL....and yet she still can write something amazing from time to time.

learn to read from the script provided and eventually you skills will be level up from time to time...

>.<

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  205
  • Reputation:   19
  • Joined:  10/12/12
  • Last Seen:  

Tired to try advices and write monologues, do whatever you want, I might not help then tho.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

Tired to try advices and write monologues, do whatever you want, I might not help then tho.

actually I understand what you mean

it just that my style of support is to write a sketch script, and ask the user to crack my script

I'm not like @ToastOfDoom, @Z3R0, Yhn or Trancid where they can give detailed explanation on how to write a script

but sadly ... the other scripting moderator which has scripting skill on par with me has gone inactive ...

I also wish @ToastOfDoom is still around and give some advice,

when he was around, we both give different kinds of script support

me gives example script, @ToastOfDoom gave detailed explanation and pseudo-code

unfortunately ... right now I'm the only active scripting moderator ...

if @ToastOfDoom is still around maybe he can change things here a little bit also

EDIT:

yeah I cannot explain to you whats the meaning of struct, or pointer ...

because I never been to any college or programming course

all the knowledge I have is just write many and many scripts with my own self-taught knowledge

that's why I just couldn't give explanation like others

... but if @ToastOfDoom ... he can ...

Edited by AnnieRuru
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  32
  • Reputation:   0
  • Joined:  10/27/12
  • Last Seen:  

thnks annie its really work.. thnks for helping me.. /??/no1

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