lunawany88 Posted November 14, 2012 Group: Members Topic Count: 10 Topics Per Day: 0.00 Content Count: 32 Reputation: 0 Joined: 10/27/12 Last Seen: November 16, 2012 Share Posted November 14, 2012 (edited) 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 November 14, 2012 by Emistry Please use [CODEBOX] or Attachments for long contents. Quote Link to comment Share on other sites More sharing options...
1 AnnieRuru Posted November 14, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 14, 2012 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 1 Quote Link to comment Share on other sites More sharing options...
Ryokem Posted November 14, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted November 14, 2012 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 Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 14, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 14, 2012 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 yesin 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 yeah lolgetd(".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 ... Quote Link to comment Share on other sites More sharing options...
Ryokem Posted November 14, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted November 14, 2012 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? Quote Link to comment Share on other sites More sharing options...
Emistry Posted November 14, 2012 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: 22 hours ago Share Posted November 14, 2012 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... >.< Quote Link to comment Share on other sites More sharing options...
Ryokem Posted November 14, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted November 14, 2012 Tired to try advices and write monologues, do whatever you want, I might not help then tho. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 14, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 14, 2012 (edited) 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 November 14, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
lunawany88 Posted November 14, 2012 Group: Members Topic Count: 10 Topics Per Day: 0.00 Content Count: 32 Reputation: 0 Joined: 10/27/12 Last Seen: November 16, 2012 Author Share Posted November 14, 2012 thnks annie its really work.. thnks for helping me.. Quote Link to comment Share on other sites More sharing options...
Question
lunawany88
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
Edited by EmistryPlease use [CODEBOX] or Attachments for long contents.
Link to comment
Share on other sites
8 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.