![]() |
Suggestion!
I remember this from when I was working on a script the last time, and I thought it might benefit the community if it was fixed.
Stefan, make getStringKeys() gs2 compatible! At the moment (unless it's been fixed already), this works: PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
When working with object oriented programming, you don't need to define a separate variable to use findNPC with for getting DB NPCs, since DB NPCs are objects themselves.
PartyControll.getstringkeys(whatever); should be good enough, though that doesn't mean that it would fix your problem (havn't looked into it, just glanced and noticed you using findNPC and definining a separate variable just to call something inside the DB itself). |
Gambet, I was merely using EXAMPLES. It doesnt work, period.
|
I'm Probably No Help But Maybe This Would Work:
with (findNPC(PartyControll)){ echo(getstringkeys("this.")); } Probably Won't Work But Just Another Way It Could Work :) |
Quote:
And your examples were inefficient. Not to mention you used the same method for each and every example, thus suggesting that you did not know that you could treat DB NPCs directly as objects. Anyways, it seems like you added on an example after viewing my post. I don't see why you grow so defensive when one has to help you based on what you show them. |
Quote:
|
Quote:
That's not the point of object oriented programming. x-x |
Quote:
|
Quote:
I don't think getstringkeys() was ever meant to be a method of the TGraalVar object, it's more along the lines of the GS2 version of getstringflags() from GS1 (or whatever that function was), but for backwards compatibility, the name had to be changed. Perhaps a better suggestion would be an extension of getvarnames/getdynamicvarnames to take a parameter and return only those variables with names that start with the parameter. I am also curious to see if perhaps getstringkeys("DB."); works. |
Quote:
I havn't talked to you about scripting in ages so if you did, then it was a while back. And do you hold this same crap against every person that you teach anything too? Because if you do, I'd hate for you to teach anyone in fear that the next time they try to correct someone with something you taught them that you'd jump in and criticize them because at ONE POINT in their life they themselves didn't know about it. And you do findPlayer("accountname").function(); because you can't do accountname.function(); -_- |
the point is, findnpc() returns an object. temp.db = findnpc("Hax"); would make temp.db the Hax object. It still uses objects. It is still as efficient as Hax. blah. Scripts are optimised when made into bytecode anyways so you don't have to jump at people for doing there way when it doesn't conform to yours.
|
Quote:
It returns an object but it's unecessary considering you don't need the object to be returned in this case to access the function. You can call the database directly via obj.function(); |
Quote:
|
Get out of the scripting forum with your bad attitude Gambet. No one cares how you think it is inefficient. Go make me a npc called Chat and try echo Chat.objecttype(). It's pretty obvious why it wouldn't work.
Ziro: Try doing: PHP Code:
|
PHP Code:
|
Quote:
|
Quote:
Quote:
Yeah, TServerNPC, thanks. :rolleyes: Quote:
It's already been suggested: Quote:
Oh, and I'll let you know when I'm in a bad mood, thanks. |
Perhaps you people are not understanding that getstringkeys() does not work with Object.varname as thats not GS1, unless that was suddenly changed from when Stefan stated it. It will only work with things that worked in GS1.
|
Quote:
I havn't tried it, but I think pfa said something similar so I'll take your word for it. |
Quote:
I tried to do getstringkeys("DBNameHere.") without any success. And on a side note to Gambet; stop lecturing me when I know EXACTLY what I'm talking about. In my pre-edit of the first post, I had this at the top of all my 3 non-working examples: PHP Code:
PHP Code:
|
Quote:
|
Quote:
|
Quote:
So you would do like dbnpcname.var1 = hi; dbnpcname.var2 = cool; dbnpcname.var3 = "sweet"; dbnpcname.var4 = 4; dbnpcname.var5 = 6; Since you are all about typing it directly but oh man check it n = findnpc("dbnpcname"); n.var1 = hi; n.var2 = cool; n.var3 = "sweet"; n.var4 = 4; n.var5 = 6; |
Quote:
|
Quote:
That falls under convenience, which falls under my two categories of efficiency: Adequacy and convenience. I'm not talking about runtime here, for it shouldn't affect runtime. But, like everything else, it all depends on the situation. If for some bizarre reason you have a DB NPC with an extremely long name, then it would be beneficial to assign a shorter variable to be read as that database. |
If you are going to use any dbnpc for prolonged periods of time and really care about the coding,
PHP Code:
|
Quote:
Quote:
Already addressed that. |
Quote:
PHP Code:
|
Quote:
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 01:28 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.