![]() |
Npc db
Ok, I was working on some random scripts, mainly for practice, and I have come to realize that I have never used a DB NPC, and I have a couple of questions I would love to get an answer to.
How can I use variables when using DB NPCs as flag holders for example if i wanted to do something like: PHP Code:
This might or might not be related to DB NPCs but I would like to know, what's the best way to work with comma separated values like for example in a variable. something like: PHP Code:
I have some other questions, but I won't ask them until I am done organizing my ideas. Thanks, Seich |
Well, the multiple flag variables that you're talking about are called arrays and this is the format:
PHP Code:
PHP Code:
In a DB NPC (which is similar or exactly the same to a local npc, ie: putnpc2) each NPC has it's own ID which can be used to identify the DB NPC. When you store a flag using a DBNPC it stores to that DB NPC, naturally. You can access it remotely by using PHP Code:
Step one, create the DB NPC, right click it and click edit flags. Step two, add all of your this. variables in to the DB NPC without the this. prefix. Step three, access your variables by using findNPC(Obj) or findNPCById(Obj). You can view the DBNPC's ID by displaying the list of DBNPCs in RC. The ID of the DBNPC is aligned on the right side of the text list. Here is my last example to show you how to access variables within the DBNPC. PHP Code:
|
Awesome.
And can those variabled be accessed anytime, anywhere? ServerSide, Clientside, etc.? Can I also add NEW variables to it, without rightclicking, edit etc..? |
Quote:
PHP Code:
|
Quote:
Thank you, that's great, I didn't know that I could store arrays in flags, well I simply never tried that. I still have one question, how can I use a dynamic flag name? like on my example with the number or, that isn't possible? |
Quote:
PHP Code:
|
That's Perfect, thanks Chris.
|
All times are GMT +2. The time now is 02:15 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.