Jump to content
  • 0

Question

Posted

I am having problem in getting the value for the @sold_card1,@sold_card2,@sold_card3,@sold_card4, and @sold_refine.

when i am selling my dagger full load with card in this order.

1 : Turtle_General_Card

2 : Doppelganger_Card

3 : Doppelganger_Card

4 : Phreeoni_Card

I do get Phreeoni_Card in @sold_card1 and the rest with no result.

Help me to solve this ..

8 answers to this question

Recommended Posts

Posted

show your script...nobody is going to guess how you make your script .... i dont even think you could get much help with the current information you provided.

Posted (edited)

callshop "EnTrade",2;

npcshopattach "EnTrade";

end;

OnSellItem:

set @totalcost,0;

for(set @i,0; @i < getarraysize(@sold_nameid); set @i,@i+1) {

dispbottom @sold_nameid[@i] + ":" + @sold_refine[@i] + ":" + @sold_card1[@i] + ":" + @card2[@i] + ":" + @sold_card3[@i] + ":" + @sold_card4[@i];

}

Sorry for that because the variables are special given for the callshop script ..

Edited by paolokupal
Posted

prontera,159,172,5	script	market#2	100,{
getitem2 1201, 1,1,0,0, 4001,4002,4003,0;
callshop "market2#hidden", 2;
end;
OnSellItem:
.@size = getarraysize( @sold_nameid );
for ( .@i = 0; .@i < .@size; .@i++ )
	dispbottom callfunc( "getitemname2", @sold_nameid[.@i], @sold_identify[.@i], @sold_refine[.@i], @sold_attribute[.@i], @sold_card1[.@i], @sold_card2[.@i], @sold_card3[.@i], @sold_card4[.@i]);
end;
OnInit:
npcshopattach "market2#hidden";
end;
}
-	shop	market2#hidden	-1,512:10,513:20,514:30,515:40,516:50

wow ... you're right, my getitemname2 function only able to show the @sold_card4, but not the card1~card3 area

maybe I should file a bug report

  • Upvote 1
Posted

ok , reported

http://rathena.org/board/tracker/issue-6847-onsellitem-only-the-sold-card4-return-value/

Index: npc.c
===================================================================
--- npc.c	(revision 16857)
+++ npc.c	(working copy)
@@ -1561,14 +1561,16 @@
static int npc_selllist_sub(struct map_session_data* sd, int n, unsigned short* item_list, struct npc_data* nd)
{
 char npc_ev[EVENT_NAME_LENGTH];
-	char card_slot[NAME_LENGTH];
-	int i, j, idx;
+	int i, idx;
 int key_nameid = 0;
 int key_amount = 0;
 int key_refine = 0;
 int key_attribute = 0;
 int key_identify = 0;
-	int key_card = 0;
+	int key_card1 = 0;
+	int key_card2 = 0;
+	int key_card3 = 0;
+	int key_card4 = 0;

 // discard old contents
 script_cleararray_pc(sd, "@sold_nameid", (void*)0);
@@ -1576,12 +1578,10 @@
 script_cleararray_pc(sd, "@sold_refine", (void*)0);
 script_cleararray_pc(sd, "@sold_attribute", (void*)0);
 script_cleararray_pc(sd, "@sold_identify", (void*)0);
-
-	for( j = 0; MAX_SLOTS > j; j++ )
-	{// clear each of the card slot entries
-		snprintf(card_slot, sizeof(card_slot), "@sold_card%d", j + 1);
-		script_cleararray_pc(sd, card_slot, (void*)0);
-	}
+	script_cleararray_pc(sd, "@sold_card1", (void*)0);
+	script_cleararray_pc(sd, "@sold_card2", (void*)0);
+	script_cleararray_pc(sd, "@sold_card3", (void*)0);
+	script_cleararray_pc(sd, "@sold_card4", (void*)0);

 // save list of to be sold items
 for( i = 0; i < n; i++ )
@@ -1596,12 +1596,11 @@
		 script_setarray_pc(sd, "@sold_refine", i, (void*)(intptr_t)sd->status.inventory[idx].refine, &key_refine);
		 script_setarray_pc(sd, "@sold_attribute", i, (void*)(intptr_t)sd->status.inventory[idx].attribute, &key_attribute);
		 script_setarray_pc(sd, "@sold_identify", i, (void*)(intptr_t)sd->status.inventory[idx].identify, &key_identify);
-		
-			for( j = 0; MAX_SLOTS > j; j++ )
-			{// store each of the cards from the equipment in the array
-				snprintf(card_slot, sizeof(card_slot), "@sold_card%d", j + 1);
-				script_setarray_pc(sd, card_slot, i, (void*)(intptr_t)sd->status.inventory[idx].card[j], &key_card);
-			}
+			script_setarray_pc(sd, "@sold_sold", i, (void*)(intptr_t)sd->status.inventory[idx].identify, &key_identify);
+			script_setarray_pc(sd, "@sold_card1", i, (void*)(intptr)sd->status.inventory[idx].card[0], &key_card1);
+			script_setarray_pc(sd, "@sold_card2", i, (void*)(intptr)sd->status.inventory[idx].card[1], &key_card2);
+			script_setarray_pc(sd, "@sold_card3", i, (void*)(intptr)sd->status.inventory[idx].card[2], &key_card3);
+			script_setarray_pc(sd, "@sold_card4", i, (void*)(intptr)sd->status.inventory[idx].card[3], &key_card4);
	 }
 }


you can try apply this noob source code to fix the bug

if developer already fix it with proper code, apply official one and throw this custom one out

  • Upvote 1
Posted (edited)

Thank you so much ! :)

Thank you so much ! :)

---

I think this code must be removed ?

script_setarray_pc(sd, "@sold_sold", i, (void*)(intptr_t)sd->status.inventory[idx].identify, &key_identify);

Edited by paolokupal
Posted (edited)

I wonder do you know how to apply a patch ? /hmm

http://rathena.org/wiki/Diff

  1. add a "-" and write the line that must be modified
    • example:[code.]-this line will be removed from the original code[/code.]

  • add a "+" and write the line that need to be placed to replace or added to the original code
    • example:[code.]+this line will be added in the new code[/code.]

Edited by AnnieRuru

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