![]() |
FOR LOOP List adjustment - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: FOR LOOP List adjustment (/Thread-FOR-LOOP-List-adjustment) |
FOR LOOP List adjustment - Mordaunt - 10-21-2012 03:47 AM Some please look at this and tell me why it isn't working, I have been looking at it for so long I have more or less gone blind to it. Code: [FUNCTION f_list_cleanup] As per the comments that I added specifically for this post. This function is designed to clean up the list when the house is transferred to a person on one of the house lists after it removes them from said list (because they are now the house owner) It should find them in the list and then shuffle everyone in the list up one spot overwriting the person who received the house in the process. It has been doing numerous things, depending on modifiations I have made, from diaplaying a name on the list twice to just not removing the names at all. RE: FOR LOOP List adjustment - RanXerox - 10-21-2012 04:01 AM In the first IF block, if none of the conditions is true, local.list is undefined... maybe add an "else return 0"? In the first FOR loop, will TAG.max_coowners TAG.max_friends or TAG.max_accesss (yes your script does add an extra "s") ever be zero? If so, your FOR loop goes from 1 to zero with possibly strange side effects... Maybe test whether those TAGs are zero and return 0 before the FOR loop starts? Also, your "inner IF statement" inside the first FOR loop references a LOCAL.lists varibale that doesn't exist. If I were you I would abandon this TAG based data structure and use an actual LIST structure: //- Added: Basic LIST support. // LIST.xxx to show elements in list. Also, can be used like LIST.xxx=value to clear list and add a value // LIST.xxx.ADD to add new element to list, can be number or string // LIST.xxx.CLEAR to clear list // LIST.xxx.index to read/write value on element in list // LIST.xxx.COUNT to get count of elements in list // LIST.xxx.index.REMOVE to remove element at specified index in list // LIST.xxx.index.INSERT to insert element at specified index in list // LIST.xxx.FINDELEM search_value returns index of first found element in list. Search starting from begin // LIST.xxx.index.FINDELEM search_value returns index of first found element in list. Search starting from index // SERV.PRINTLISTS to print all lists and their elements // SERV.CLEARLISTS to clear all lists. If used with mask parameter, then clear all lists, which name countains specified mask RE: FOR LOOP List adjustment - Skul - 10-21-2012 04:14 AM Ran - Mordaunt, add an 'if' at the very top of your first 'if' statement: Code: if (<ref1.is_coowner>) || (<ref1.is_friend>) || (<ref1.can_access) |