The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Vendor Supply
Author Message
Van Glan Bloom
Journeyman
*

Posts: 104
Likes Given: 2
Likes Received: 3 in 3 posts
Joined: Jun 2013
Reputation: 0



Post: #1
Vendor Supply
Hi guys,

What i make wrong in this script? I try make a vendor suplly where the player can choose the number of itens for buy. However the script is not to check if the player has the necessary money in the bag

I have this :

Code:
if (src.findlayer(21).rescount i_gold> < (<EVAL(<ARGTXT[0]>) *100>)
src.sysmessage @09c1 You do not have enought gold coins to trade.
else
serv.newitem i_log, <eval(<argtxt[0]>)>,<src.findlayer.21.uid>
src.consume i_gold (<eval(<argtxt[0]>) *100)
src.act.bounce
return 1
endif




This problem is solved.
Now i have other bug, if I Enter a value that is not numeric it gives error in sphere

Code:
04:49:ERROR:(System - NPC Vendor Supply.scp,505)Undefined symbol '' ['<a']

I can indicate that the script can only enter numeric values?




The problem is Solved, thx
(This post was last modified: 06-13-2015 01:59 PM by Van Glan Bloom.)
06-13-2015 01:25 PM
Find all posts by this user Like Post Quote this message in a reply
Van Glan Bloom
Journeyman
*

Posts: 104
Likes Given: 2
Likes Received: 3 in 3 posts
Joined: Jun 2013
Reputation: 0



Post: #2
RE: Vendor Supply
Hi again,

Is there any function to which the items are not left in steaks? For example when I buy more than one pick, they do not see to the bag as two individual items whenever an item comes with the following settings "to 2 pickaxe"


Can you define the script, so will the number of items ordered but as individual items?
06-13-2015 11:08 PM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #3
RE: Vendor Supply
there's a missing < on the first line
if (<src.findlayer(21).rescount i_gold> < (<EVAL(<ARGTXT[0]>) *100>)
06-15-2015 07:23 AM
Find all posts by this user Like Post Quote this message in a reply
Van Glan Bloom
Journeyman
*

Posts: 104
Likes Given: 2
Likes Received: 3 in 3 posts
Joined: Jun 2013
Reputation: 0



Post: #4
RE: Vendor Supply
Hi coruja,

I have fixed the problem, but thanks anyway =) But I wonder if it is possible buy some itens in vendor ( type pickaxes ) and the same itens come for bag separate and no in steacks?!
06-15-2015 07:53 AM
Find all posts by this user Like Post Quote this message in a reply
JohnVeritas
Apprentice
*

Posts: 49
Likes Given: 0
Likes Received: 4 in 4 posts
Joined: Feb 2014
Reputation: 2



Post: #5
RE: Vendor Supply
Try this one;

after every check is ok

serv.newitem i_bag
src.bounce <new>
ref1=<new.uid>
serv.newitem i_blabla
new.cont <ref1>
06-15-2015 09:38 AM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #6
RE: Vendor Supply
Pickaxes should not stack, if they are stacking you should have something wrong in your tiledata.mul.
As aditional fix you can set MaxAmount=1 in their ITEMDEF
06-15-2015 04:28 PM
Find all posts by this user Like Post Quote this message in a reply
Van Glan Bloom
Journeyman
*

Posts: 104
Likes Given: 2
Likes Received: 3 in 3 posts
Joined: Jun 2013
Reputation: 0



Post: #7
RE: Vendor Supply
In my vendor supply i have this

Code:
on=7
if (0<ISEMPTY <ARGTXT[0]>>)||(STRMATCH(*[a-z]*,<ARGTXT[0]>))||!(STRMATCH(*[0-9]*,<ARGTXT[0]>))
src.sysmessage @09c1 This is not a real value!!
return 1
elseif <src.findlayer(21).rescount i_gold> < (<ARGTXT[0]>) *100)
src.sysmessage @09c1 You do not have enought gold coins to trade.
else
serv.newitem i_pickaxe, <eval(<argtxt[0]>)>,<src.findlayer.21.uid>
src.consume i_gold (<argtxt[0]>) *100
src.sysmessage @09c1 You have buy <eval(<argtxt[0]>)> pickaxe's and pay <eval(<argtxt[0]>) *100)> gold's
return 1
endif

And i have add in the pickaxe the maxamount=1, but the pickaxes continue stacking =/


Attached File(s) Thumbnail(s)
   
(This post was last modified: 06-15-2015 10:50 PM by Van Glan Bloom.)
06-15-2015 10:46 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #8
RE: Vendor Supply
It's happening because the 2nd argument of serv.newitem is the amount value, so Sphere set the amount value of the pickaxe to: <eval(<argtxt[0]> (in the screenshot the amount value is 2). So you have to check if the item is actually a "stackable item".
but you already know that the pickaxe is not a stackable item, so you have to put each item in the backpack by bouncing it.

PHP Code:
on=7
if (0<ISEMPTY <ARGTXT[0]>>)||(STRMATCH(*[a-z]*,<ARGTXT[0]>))||!(STRMATCH(*[0-9]*,<ARGTXT[0]>))
src.sysmessage @09c1 This is not a real value!!
return 
1
elseif <src.findlayer(21).rescount i_gold> < (<ARGTXT[0]>) *100)
src.sysmessage @09c1 You do not have enought gold coins to trade.
else
FOR <eval(<
argtxt[0]>)>
serv.newitem i_pickaxe
new.bounce
ENDFOR
src.consume i_gold (<argtxt[0]>) *100
src
.sysmessage @09c1 You have buy <eval(<argtxt[0]>)> pickaxe's and pay <eval(<argtxt[0]>) *100)> gold's
return 1
endif 
06-15-2015 11:48 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)