Lil Troll Posted August 1, 2013 Group: Members Topic Count: 38 Topics Per Day: 0.01 Content Count: 276 Reputation: 24 Joined: 07/06/13 Last Seen: April 19, 2014 Share Posted August 1, 2013 (edited) Guys can anyone knows how to check this script and make it working?The idea is, switching items, i attached callfunc in items. Item 1: (17505) Menu Switching, here you can save your equip item in the slots so that you can instantly change what you desired. Item 2~4: (17506++) Switching Slot(You will save your switch in the slot you like and you can Name it.) Item_Db2.txt: 17505,Switch_MotorM,Switch Motor,0,50,,70,,,,,0xFFFFFFFF,7,2,,,,,,{ doevent "Equip_Switch::OnCFMenu"; },{},{} 17506,Switch_Motor1,Switch #1,0,50,,70,,,,,0xFFFFFFFF,7,2,,,,,,{ getitem 17506,1; callfunc("Switch_Equip::equip getarg(0)1"); },{},{} 17507,Switch_Motor2,Switch #2,0,50,,70,,,,,0xFFFFFFFF,7,2,,,,,,{ getitem 17507,1; callfunc("Switch_Equip::equip getarg(0)2"); },{},{} 17508,Switch_Motor3,Switch #3,0,50,,70,,,,,0xFFFFFFFF,7,2,,,,,,{ getitem 17508,1; callfunc("Switch_Equip::equip getarg(0)3"); },{},{} Now whats the script about is, When you click the 17505 item a menu will appear prompting:[save Switching Item] [switching Items]. And this is the whole script, i based it from Build_Manager.txt - script Switching_Equips -1,{ // Enable Slot Rename set .SwitchRename,1; // Max Switching Slots - To add another slot, make another ITEM. See [item_db2.txt]. set .MaxSlots,3; OnCFMenu: function Equip_Switch { getitem 17505,1; switch(prompt("[Save Switching Items]:[Switching Items]")) { Case 1: callfunc "Save_Switch"; next; break; Case 2: if (countitem(17508) == 0); getitem 17508,1; if (countitem(17508) > 1); delitem 17508,30000; if (countitem(17507) == 0); getitem 17507,1; if (countitem(17506) > 1); delitem 17507,30000; if (countitem(17506) == 0); getitem 17506,1; next; break; } } function Save_Switch; { mes "^0000FF_____________________________^000000"; mes "^FF0000@^000000 Upper Head - "+getitemname(getequipid(1)+" ^FF0000@^000000 Lower Head - "+getitemname(getequipid(10)+" ^FF0000@^000000 Middle Head - "+getitemname(getequipid(9)+""; mes "^FF0000@^000000 Foot Gear - "+getitemname(getequipid(6)+" ^FF0000@^000000 Armor - "+getitemname(getequipid(2)+" ^FF0000@^000000 Garment - "+getitemname(getequipid(5)+""; mes "^FF0000@^000000 Left Weapon - "+getitemname(getequipid(3)+" ^FF0000@^000000 Right Weapon - "+getitemname(getequipid(4)+""; mes "^FF0000@^000000 Left Accessory - "+getitemname(getequipid(7)+" ^FF0000@^000000 Right Accessory - "+getitemname(getequipid(8)+""; mes "^0000FF_____________________________^000000"; message strcharinfo(0),"Input 0 to Cancel"; for( set .@i,1; .@i <= .MaxSlots; set .@i,.@i + 1 ){ input .@a,0,.MaxSlots; if( .@a != 0 ){ callfunc("SaveEquip",.@a,.SwitchRename); next; break; } } function Save_Equip; { setd ".itemid1"+getarg(0),getequipid(1); // HELM UPPER setd ".itemid2"+getarg(0),getequipid(9); // HELM MID setd ".itemid3"+getarg(0),getequipid(10); // HELM LOWER setd ".itemid4"+getarg(0),getequipid(2); // ARMOR setd ".itemid5"+getarg(0),getequipid(6); // FOOT setd ".itemid6"+getarg(0),getequipid(5); // GARM setd ".itemid7"+getarg(0),getequipid(3); // WEAP L setd ".itemid8"+getarg(0),getequipid(4); // WEAP R setd ".itemid9"+getarg(0),getequipid(7); // ACC L setd ".itemid10"+getarg(0),getequipid(8); // ACC_R if( getarg(1) ){ do{ message strcharinfo(0),"Input the Name for this Switch. [ Max. 12 Chars ]"; input getd( "Slot_"+getarg(0)+"$" ); } while( getstrlen( getd( "Slot_"+getarg(0)+"$" ) ) > 12 ); } else{ set getd( "Slot_"+getarg(0)+"$" ),".itemid$+ "+getarg(0); } return; } function Switch_Equip; { equip (getd(".itemid1"+getarg(0))-1); equip (getd(".itemid2"+getarg(0))-1); equip (getd(".itemid3"+getarg(0))-1); equip (getd(".itemid4"+getarg(0))-1); equip (getd(".itemid5"+getarg(0))-1); equip (getd(".itemid6"+getarg(0))-1); equip (getd(".itemid7"+getarg(0))-1); equip (getd(".itemid8"+getarg(0))-1); equip (getd(".itemid9"+getarg(0))-1); equip (getd(".itemid10"+getarg(0))-1); dispbottom "Equip change to ( "Slot_"+getarg(0)+"$" )"; return; } } } Is switching is possible attaching in items like this? Edited August 1, 2013 by Lil Troll Quote Link to comment Share on other sites More sharing options...
GmOcean Posted August 1, 2013 Group: Members Topic Count: 31 Topics Per Day: 0.01 Content Count: 666 Reputation: 93 Joined: 04/27/12 Last Seen: August 17, 2015 Share Posted August 1, 2013 Hmm, it's not too hard to make, but sadly, it is quite an advanced request. Some issue I can see with your script is: 1. Your storing information of the equipped item, but as far as I know it only stores the <item_id>. This means that if you want to equip it later, it will equip anyitem that has the same ID. ex: You store the equips, and your wearing a +10 Knife. Then you put on a +10 Blade. And now want to switch back, if you have a +0 Knife in your inventory, BEFORE the +10 Knife, it will equip the +0 Knife because the +10 Knife comes after it in the inventory space. To fix this you need to store all of it' information (Refine-rate, Cards, Item ID). This information can be retrieved and filtered using "getinventorylist" command. You would first, use the command, to create a group of arrays. Then you would filter out which ones you need, by seeing if it's equipped, using one of the arrays it creates (@inventorylist_equip[]) 2. Your saving the information into an NPC variable. While this may be more resource friendly vs, saving to a Perm-Char variable, I suggest using a MySQL database, to store the information, so it can be called later, additionally this will allow for alot of improvements to be made later if needed. Now while not an ' issue ' with the script. You could use loops and arrays to equip and display the builds. Reducing the length of the script, and making it look cleaner. Hope this helps you in regards to structuring your script. Quote Link to comment Share on other sites More sharing options...
Lil Troll Posted August 3, 2013 Group: Members Topic Count: 38 Topics Per Day: 0.01 Content Count: 276 Reputation: 24 Joined: 07/06/13 Last Seen: April 19, 2014 Author Share Posted August 3, 2013 (edited) Wow thanks for the information! Although I dont know how to make that i will try doing it, going to find some @inventorylist scripts here so that i will try to disect it for further use. Thanks again! Uhmm can you explain to me what is this: @i,@i+1 In this? getinventorylist; for(set .@i,0; .@i < @inventorylist_count; set .@i,.@i+1){ if(@inventorylist_id[.@i] == 512){ // 512 is the item id for apple mes "You have an apple with you!"; close; } } mes "You don't have an apple with you :("; close; Edited August 3, 2013 by Lil Troll Quote Link to comment Share on other sites More sharing options...
Xynvaroth Posted August 3, 2013 Group: Members Topic Count: 39 Topics Per Day: 0.01 Content Count: 254 Reputation: 72 Joined: 07/10/13 Last Seen: October 9, 2017 Share Posted August 3, 2013 To answer your question directly, it will change the value of the .@i variable to .@i + 1. In plain language, it will increase the value of .@i by one. You should, however, make sure that you also understand the for( ) statement properly in general. I am saying this due to the fact that if you have learned how for( ) works, you normally also know what this statement does. Quote Link to comment Share on other sites More sharing options...
Question
Lil Troll
Guys can anyone knows how to check this script and make it working?
The idea is, switching items, i attached callfunc in items.
Item 1: (17505) Menu Switching, here you can save your equip item in the slots so that you can instantly change what you desired.
Item 2~4: (17506++) Switching Slot(You will save your switch in the slot you like and you can Name it.)
Item_Db2.txt:
Now whats the script about is, When you click the 17505 item a menu will appear prompting:
[save Switching Item] [switching Items].
And this is the whole script, i based it from Build_Manager.txt
Is switching is possible attaching in items like this?
Edited by Lil TrollLink to comment
Share on other sites
3 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.