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
Problem with Player Vendor System
Author Message
nobody2k
Apprentice
*

Posts: 11
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Feb 2015
Reputation: 0



Post: #1
Problem with Player Vendor System
Hi all!

I just started to script an own Player-vendor system, nothing special, just an easy to use system for max 10 items.

Actually, it's based on an NPC "c_vendor" which I created, the Gump appears when I DClick on the NPC.
I want to place the items inside the "vendor container" (the thing that opens up when you say "stock", it's layer 26) and store the Serial of every item in an own tag (TAG is stored at the NPC, so it's "tag.item1", "tag.item2", "tag.item3",... )

Now, when the GUMP shows up I want to display all the items (their name, amount an price).
I tried that using <SERV.ITEMDEF.<TAG.item1>.NAME> ... but it only shows "0"^^
Using EVAL, gives the the same name "0", which is actually NOT the name of a mark scroll (in my example)...

Could someone please help me, I just ran out of ideas Smile

thx in advance!

greeting, Chris
02-27-2015 06:53 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: #2
RE: Problem with Player Vendor System
Probably is caused by this:

When you dclick(@charDclick) the vendor, the gump is sent to the player and the only reference inside the gump is the player and not the vendor.
So it's actually looking in the player tags instead of looking in the vendor tags.
The solution is to pass a reference (the vendor uid) along with the gump.

Wrong Example
PHP Code:
ON=@CharDclick
dialog d_test_gump
,0,<act>   //act holds  the vendor uid,    0 is the gump page 

[DIALOG d_test_gump]
0,0
REF1
=<args>  // args holds the uid of the vendor, it will be saved inside REF1, REFx  can holds uid of  items and chars
page 0
resizepic 0 0 2620 150 100
page 1
dtext 10 50 1152 Hello 
<ref1.name//Here we show the name of the Npc dclicked
button 30 70 2473 2472 1 0 1000

[DIALOG d_test_gump BUTTON]
ON=1000
 
      SYSMESSAGE  Bye 
<ref1.name>
     
// Problem ! When the button is clicked Bye 0 will be displayed, that's because we have lost the reference to the vendor.
     //REFx "exists" only inside the block of code  in which we have declared it.
     //We can't use ref1=<args> inside the button block, because the vendor uid is actually sent only "graphic" part of the gump. 

A simple right example is to store the vendor uid inside a player tag

PHP Code:
ON=@CharDclick
tag
.vendorUID = <act>
dialog d_test_gump   //We don't have to send the uid of the vendor anymore
                             //Because we can directly access it from the player.

[DIALOG d_test_gump]
0,0
REF1
=<tag0.vendorUID>  //We save the tag in REF1, we use tag0 for precaution
page 0
resizepic 0 0 2620 150 100
page 1
dtext 10 50 1152 Hello 
<ref1.name//Here we show the name of the Npc dclicked
button 30 70 2473 2472 1 0 1000

[DIALOG d_test_gump BUTTON]
ON=1000
      REF1
= <tag0.vendorUID>
      
SYSMESSAGE  Bye <ref1.name

Anyway, this solution will create other problem that you will discover sisi
(This post was last modified: 02-27-2015 07:53 PM by darksun84.)
02-27-2015 07:51 PM
Find all posts by this user Like Post Quote this message in a reply
nobody2k
Apprentice
*

Posts: 11
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Feb 2015
Reputation: 0



Post: #3
RE: Problem with Player Vendor System
Hi!

Thank you for your answer!
I worked around my problems and solved it by using the backpack of the Vendor NPC. Smile

I had to gump a whole new "buy script" then, but it is completed and working. Smile
03-05-2015 10:42 PM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes nobody2k's post
Post Reply 


Forum Jump:


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