Jump to content
  • 0

[solved] marketshop quantity


jamesandrew

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.07
  • Content Count:  58
  • Reputation:   3
  • Joined:  06/21/23
  • Last Seen:  

How to refresh the quantity of an item in stock? (market_refine_)
I tried @reloadscript @reloadbarterdb and even restarted the server, it didn't work.
The stock stays the same like the last time I purchased the item

//=Ore Exchanger
//============================================================
-	marketshop	market_refine_prt_in	-1,1010:-1:999999,1011:-1:999999
-	marketshop	market_refine_payon	-1,1010:-1:999999,1011:-1:999999
-	marketshop	market_refine_morocc_in	-1,1010:-1:999999,1011:-1:999999
-	marketshop	market_refine_alberta_in	-1,1010:-1:999999,1011:-1:999999
-	marketshop	market_refine_yuno_in01	-1,1010:-1:999999,1011:-1:999999
-	marketshop	market_refine_ein_in01	-1,1010:-1:999999,1011:-1:999999
-	marketshop	market_refine_lhz_in02	-1,1010:-1:999999,1011:-1:999999

prt_in,63,69,3	script	Dietrich#ns_prt	4_M_02,{
	mes "[" + strnpcinfo(1) + "]";
	mes "We sell and exchange various ores used in smelting.";
	next;
	switch( select( "View basic smelting ores", "View advanced smelting ores", "Cancel" ) ) {
	case 1:
		mes "[" + strnpcinfo(1) + "]";
		mes "Phracon and Emveretarcon are available for use in smelting low-level weapons.";
		close2;
		callshop "market_refine_" + strnpcinfo(4);
		end;
	case 2:
		mes "[" + strnpcinfo(1) + "]";
		mes "We are purifying Elunium Stone and Oridecon Stone, or exchanging Coins.";
		close2;
		callshop "barter_refine_1";
		end;
	case 3:
		mes "[" + strnpcinfo(1) + "]";
		mes "If you lack the materials used for smelting, come anytime.";
		close;
	}
	end;

OnInit:
	setunittitle getnpcid(0), "<Ore Refiner>";
	end;
}

I'm using the latest git and pre renewal.

image.png.e6f911961f5736f02c4fe0698120e12b.png

Edited by jamesandrew
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 1

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

If you want to update the stock programmatically, for example on a certain event, you can use npcshopupdate.

*npcshopupdate "<name>",<item_id>,<price>{,<stock>}

Update an entry from a shop. If the price is 0 it won't be changed. May also be used for
marketshop to update the stock quantity. For unlimited stock, use -1.
For other shop types, the stock value has no effect.

Which means to reset the stock of item 1010 in the market_refine_prt_in shop, you would do it like this:

npcshopupdate("market_refine_prt_in", 1010, 0, 999999);

If you want to simply change the stock for testing purposes, you could edit the shop in the market table in the database.

In your NPCs case, if you check line 588 in the file npc/merchants/refine.txt, you will see the NPC refine_barter_init.
Which uses above-mentioned npcshopupdate to update the stocks of the NPCs in your post when the script gets loaded.

So if you only care about resetting the stock of those, reloading only the script where the shops are defined should suffice.
You can use this command to do this:

@reloadnpcfile npc/merchants/refine.txt

 

Edited by Winterfox
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.07
  • Content Count:  58
  • Reputation:   3
  • Joined:  06/21/23
  • Last Seen:  

3 hours ago, Winterfox said:

If you want to update the stock programmatically, for example on a certain event, you can use npcshopupdate.

*npcshopupdate "<name>",<item_id>,<price>{,<stock>}

Update an entry from a shop. If the price is 0 it won't be changed. May also be used for
marketshop to update the stock quantity. For unlimited stock, use -1.
For other shop types, the stock value has no effect.

Which means to reset the stock of item 1010 in the market_refine_prt_in shop, you would do it like this:

npcshopupdate("market_refine_prt_in", 1010, 0, 999999);

If you want to simply change the stock for testing purposes, you could edit the shop in the market table in the database.

In your NPCs case, if you check line 588 in the file npc/merchants/refine.txt, you will see the NPC refine_barter_init.
Which uses above-mentioned npcshopupdate to update the stocks of the NPCs in your post when the script gets loaded.

So if you only care about resetting the stock of those, reloading only the script where the shops are defined should suffice.
You can use this command to do this:

@reloadnpcfile npc/merchants/refine.txt

 

Thanks for the explanation. Very helpful!
 

So... If I want to use unlimited quantity for 1010 and 1011 can I use marketshop and change the quantity to -1 ?

//=Ore Exchanger
//============================================================
-	marketshop	market_refine_prt_in	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_payon	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_morocc_in	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_alberta_in	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_yuno_in01	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_ein_in01	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_lhz_in02	-1,1010:-1:-1,1011:-1:-1

prt_in,63,69,3	script	Dietrich#ns_prt	4_M_02,{
	mes "[" + strnpcinfo(1) + "]";
	mes "We sell and exchange various ores used in smelting.";
	next;
	switch( select( "View basic smelting ores", "View advanced smelting ores", "Cancel" ) ) {
	case 1:
		mes "[" + strnpcinfo(1) + "]";
		mes "Phracon and Emveretarcon are available for use in smelting low-level weapons.";
		close2;
		callshop "market_refine_" + strnpcinfo(4);
		end;
	case 2:
		mes "[" + strnpcinfo(1) + "]";
		mes "We are purifying Elunium Stone and Oridecon Stone, or exchanging Coins.";
		close2;
		callshop "barter_refine_1";
		end;
	case 3:
		mes "[" + strnpcinfo(1) + "]";
		mes "If you lack the materials used for smelting, come anytime.";
		close;
	}
	end;

OnInit:
	setunittitle getnpcid(0), "<Ore Refiner>";
	end;
}
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

4 hours ago, jamesandrew said:

Thanks for the explanation. Very helpful!
 

So... If I want to use unlimited quantity for 1010 and 1011 can I use marketshop and change the quantity to -1 ?

//=Ore Exchanger
//============================================================
-	marketshop	market_refine_prt_in	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_payon	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_morocc_in	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_alberta_in	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_yuno_in01	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_ein_in01	-1,1010:-1:-1,1011:-1:-1
-	marketshop	market_refine_lhz_in02	-1,1010:-1:-1,1011:-1:-1

prt_in,63,69,3	script	Dietrich#ns_prt	4_M_02,{
	mes "[" + strnpcinfo(1) + "]";
	mes "We sell and exchange various ores used in smelting.";
	next;
	switch( select( "View basic smelting ores", "View advanced smelting ores", "Cancel" ) ) {
	case 1:
		mes "[" + strnpcinfo(1) + "]";
		mes "Phracon and Emveretarcon are available for use in smelting low-level weapons.";
		close2;
		callshop "market_refine_" + strnpcinfo(4);
		end;
	case 2:
		mes "[" + strnpcinfo(1) + "]";
		mes "We are purifying Elunium Stone and Oridecon Stone, or exchanging Coins.";
		close2;
		callshop "barter_refine_1";
		end;
	case 3:
		mes "[" + strnpcinfo(1) + "]";
		mes "If you lack the materials used for smelting, come anytime.";
		close;
	}
	end;

OnInit:
	setunittitle getnpcid(0), "<Ore Refiner>";
	end;
}

Exactly.  npcshopupdate uses the same arguments for stocks as the marketshop itemlist, as it is also explained in the script documentation:

"marketshop" can have limited quantity of an item in stock.
Use -1 in the stock field to have unlimited stock in a marketshop.


 

  • Upvote 1
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...