![]() |
Delete flag from DB?
Is there any way to totally remove a flag from a DBNPC? Atm, i'm using this.("test_"@ whatever) = NULL; but that just sets the flag to 0. I also tried using this.("test_"@ whatever).delete(); and this.("test_"@ whatever).remove(); but neither of them work. Can anyone help me out here?
|
You can un-assign/destroy variables with:
this.("test_"@ whatever) = ""; |
Just remember that everything in GS2 is a string, and that NULL is a lie.
|
There is also obj.clearEmptyVars(); which will delete 0 or NULL values from the flags. It doesn't really matter, though, since they're removed on server restart and don't interfere with the operation of the DB anyway.
|
null = 0 != ""
However, sometimes it does, sometimes it doesn't... |
Quote:
Either way it doesn't matter though. |
Quote:
|
Yeah, it seems "" totally clears the variable. But yeah, usually when you set a client or clientr flag to NULL, Graal will recognize the 0 as nothing and just clear it. I figured the same applied to variables in NPC's, but I guess not. -.o Thanks anyways guys. :D
|
Quote:
|
Okay, so I figured instead of making a new thread, I would just post this issue here. I'm now having trouble checking for a clientr flag while using a for loop in the check. I'm setting temp.i using a for loop, than trying to check a clientr flag using temp.i, atm i'm trying clientr.backpack_size(@ i+1), but it keeps returning as null when it should return as either "Small" or "Medium" Can anyone tell me how to fix this? Here's the code:
PHP Code:
|
Are you trying to use an array?
These code snippets should help.. PHP Code:
You can use makevar or through the dot notation way. temp.bagsize = makevar("clientr.backpack_size" @ i + 1); temp.bagsize = clientr.("backpack_size" @ i + 1); |
No, i'm actually not using an array, i'm simply doing this:
clientr.backpack_slots=# (At the moment, I have it set to 2 in my chars attributes). Using the slot flag, i'm checking for which slot the player is interacting with. Than I'm doing clientr.backpack_size#=size;.. which in my case I have clientr.backpack_size1=Small, and clientr.backpack_size2=Medium. What i'm trying to do is set temp.i to clientr.backpack_slots (Which is working because i'm displaying stuff using that flag.) than, i'm trying to display backpacks according to whether or not clientr.backpack_size is NULL or not. x_x |
try
PHP Code:
|
Quote:
|
Quote:
|
All times are GMT +2. The time now is 04:55 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.