ScriptUO

Official ScriptUO EasyUO Scripts => Script Library => Script development tools => Topic started by: TrailMyx on June 09, 2008, 12:22:38 PM

Title: TrailMyx's List Handling Subs
Post by: TrailMyx on June 09, 2008, 12:22:38 PM
Code: [Select]
;=================================================================
; Script Name: TrailMyx's List Handling Subs
; Author: TrailMyx
; Version: 0.27
; Shard OSI / FS: OSI / FS OK
; Revision Date: 3/12/2008
; Purpose: Take the pain out of managing lists
;
; Subroutines included:
;   TM_CreateList - Creates the list
;   TM_DrawList
;   TM_HideList
;   TM_ReDrawList
;   TM_AddToList
;   TM_DeleteAllItemsInList
;   TM_CopyAllItemsInList
;   TM_DeleteIndexedItemInList
;   TM_DeleteExactItemsInList
;   TM_DeleteExactTagsInList
;   TM_DeleteItemsInList
;   TM_DeleteTagsInList
;   TM_SearchForExactItemInList
;   TM_SearchForExactTagInList
;   TM_SearchForItemInList
;   TM_SearchForTagInList
;   TM_CountExactItemsInList
;   TM_CountExactTagsInList
;   TM_CountItemsInList
;   TM_CountTagsInList
;   TM_AlphabetizeList
;   TM_GetSelectedItem
;   TM_GetSelectedTag
;   TM_GetIndexedItem
;   TM_GetIndexedTag
;   TM_GetListSize
;   TM_MoveSelectedItemDown
;   TM_MoveSelectedItemUp
;
; Requirements:
;
; Locals/Globals:
;   TM_window_list_ , %2 (local)
;
; Special Thanks:
;
;=================================================================
;

Note: Version 31 saves information to the registry and not a flat file.  However it's much faster.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on November 03, 2008, 08:45:25 PM
Was just playing with these subs a bit and decided to add something that Khameleon was talking about way back on uocoders.  He was thinking it would be nice to allow for the script to track not only the visible list item, but also an additional piece of data that won't be displayed.  So here's a sample of what I'm talking about:

Code: [Select]
set %font_arial MS , #SPC , Ariel
gosub showEUOMenu1
gosub TM_CreateList List Newlist1 4 4 345 289 White WindowText %font_arial 8
set #LPC 100
repeat
  finditem * G_18
  if #FINDKIND <> -1
  {
    event property #FINDID
    str pos #PROPERTY $
    set #STRRES #STRRES - 1
    str left #PROPERTY #STRRES
    gosub TM_AddToList Newlist1 #STRRES #FINDID
    ignoreitem #FINDID
  }
until #FALSE
stop
;--------- EasyUO Menu Designer Code Begin ---------
sub showEUOMenu1
menu Clear
menu Window Title Test
menu Window Color BtnFace
menu Window Size 442 298
menu Show 421 270
return
;--------- EasyUO Menu Designer Code End ---------

This code will save all incoming items it finds on the ground and places them into the list you can see.  It also makes a note of the #FINDID associated with the item.  You can go back later and do searches on either the "Items" information or the "Tag" information.  Where:

Item = displayable
Tag = non-displayable

So specifically, the syntax to add the item text and tag looks like:

Code: [Select]
gosub TM_AddToList Newlist1 #STRRES #FINDID ; added the 3rd argument (the Tag)

About NODRAW lists:

Normally these subs are meant to replace instances of menu list or menu combo, but there are times when you might want to use a list as a data structure to generally hold information.  For that you can:

Code: [Select]
gosub TM_CreateList NODRAW Newlist2 110 10 100 100 White WindowText %font_arial 8

This will create a list, but not associate it with anything on the screen.  Be sure to have a unique name, i.e. you cannot have a NODRAW list named NewList2 and a Combo List NewList2.
Be looking for version 2.1 of this set of subs.  I'm playing with them now and will post them soon.  Not that anyone uses them, but what the heck.
Title: Re: TrailMyx's List Handling Subs
Post by: Khameleon on November 04, 2008, 02:13:23 PM
I use em :P
I haven't really the time to sit down and write a full blown script in a while... to many annoying variables in the background atm.
Title: Re: TrailMyx's List Handling Subs
Post by: Khameleon on February 23, 2009, 02:05:07 PM
oh Man, I didn't see this update I was about to tear my hair out trying to handle to forms of lists. now this will definitely work.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 23, 2009, 02:09:00 PM
Ya, that sample code makes it pretty clear what will be displayed and what will be tracked.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on June 10, 2009, 08:54:36 PM
Updated to 0.23

I realized I didn't write two necessary functions for selecting the selected item and selected tag from the list.  Add 2 new functions:

TM_GetSelectedItem
TM_GetSelectedTag
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 26, 2010, 11:27:15 AM
I just fell in love with you all over again.  Thanks for making this TM.  Be prepared for ?'s. :)  Looks pretty self explanatory tho.  Just tested and added the ID and TYPE to the list behind the parsed name... now it's a all item id identifyer within range. :)  Love it.  Going to see about making a dynamic targetting menu... We'll see.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 26, 2010, 12:21:55 PM
I have some added functionality that I need to post up.  If you want to see the latest and greatest versions, look in the MIB hunter script.  Also there's some good examples in there.  IN the mean time, I'll try and get these revised since I did find some bugs.  But since only Kham and I used these, I didn't feel all that motivated to fix'em.

If you like these, then you'll really like my next project.  ;)
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 26, 2010, 12:29:15 PM
But since only Kham and I used these, I didn't feel all that motivated to fix'em.
If you like these, then you'll really like my next project.  ;)

I can't believe only you two used these... these are HORRIBLY usefull. :)  Especially if you like nice menus! heh  I gotta look into selecting menu items... I haven't decided if I want to make the list update dynamically.. which would be NICE, but might not be as usefull as a list you can EDIT, and move names around... Is there a sub in there that will let you order them the way you like besides alphabetical?  I didn't look. :)  Move up and down list... then you could prioritize lists based on your preference...  I have a feeling you added that functionality without me looking to see, because we were discussing the other night how all your stuff has what you need and the kitchen sink usually... heh
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 26, 2010, 12:39:06 PM
Lol, well with code like this, it's easy to leave out that totally necessary sub.  It's only when you get into it on a project basic and realize, "Oh crap, I forgot to add access to this stuff!"  So thanks to the MIB hunter that brought out the additional functionality need.

But unfortunately, most scripters don't really try to push the envelop of their UIs.  That's kinda what my next project is all about.  If I can get this new job locked down, I'll probably have more time to play with things like this.  This kinda came from my experience with the CLAw.  However, I didn't have these routines during that time.  Shame, it would be nice to stub them in there.

Did you manage to get them working somewhat?
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 26, 2010, 12:54:37 PM
Did you manage to get them working somewhat?

Somewhat?  Just using 2 of the subs I've done most of what I want.  When I add saving and editing of the list... it will be amazing. :)  How can I access the data I save for each instance in the list?  Ah, I see the #findid in the third tag is EXACTLY what is needed. I'm luvin it.  You say you can't display the #findid... but you can... I did in my lists... I displayed the item, and the #findid and the #findtype in the list... :)
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 26, 2010, 12:57:04 PM
I'm also sorting the lists, I'll have 4 I think, based on #findrep and things I determine in #property when it scans.  2 of the lists will be hidden because they really aren't necessary... but I'll add the functionality and play with it till I come up with better ideas for it.  I know I'll have ideas for the 2 hidden lists eventually. :)  I hate "WHY DIDNT YOU ADD *insert someones great idea*"  stuff.  So I try to plan for it. heh
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 26, 2010, 12:57:43 PM
Well it's totally up to you what goes into the visible part of the list.  The "tag" part is really there for you to compare against for searching or other reference.  It's the programmers choice for the visible part.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 26, 2010, 02:00:54 PM
Ok, so sometimes I need a prompting to get something going.  I've had a few new unpublished version of these subs, and I just merged the bug fixes that I found from another project.  The notable additions are:

;   TM_GetIndexedItem
;   TM_GetIndexedTag
;   TM_GetListSize

Also I fixed a few places where the #LPC might run away and not get reset.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 26, 2010, 02:32:35 PM
Ok, so sometimes I need a prompting to get something going.  I've had a few new unpublished version of these subs, and I just merged the bug fixes that I found from another project.  The notable additions are:

;   TM_GetIndexedItem
;   TM_GetIndexedTag
;   TM_GetListSize

Also I fixed a few places where the #LPC might run away and not get reset.

I have a bad habit of writing without thinking.  And having to go back and do it all again with a new and better idea.  I'm starting to hate you for making me love dynamic menu lists... :)  Thanks for updating that tho.  GetIndexTag is EXACTLY what I freakin need. :)  I need to check those out.  So if I were to use menu get "menu name" and the menu item selected was 3?  Could I just do getindexeditem 3?  Is that how that works?  Just guessing without looking. :)  Get list size is for scanning through the list somehow I'm guessing, so you don't just scan indefinately... heh
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 26, 2010, 02:49:56 PM
Well you'll have to look at the code.  But you'll see that you are requesting an index number from the array of information that's in the namespace that encloses each menu.  In the case of TM_GetIndexedItem:

gosub TM_GetIndexedItem LISTBOX 3 ; tries to retrieve the 4th item (remember index 0 is a valid index, returns #TRUE if an error)

will return the !list3 value.  This lets you iterate through everything in the list.  Same can be said for TM_GetIndexedTag.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 26, 2010, 03:26:24 PM
Wouldn't it be infinately easier to just make them match? :)  Getlistitem 3 menures 3....  I can handle it tho since I didn't write it and it's free, and works awesome. :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 26, 2010, 03:34:49 PM
Well it's just a naming thing.  You are thinking about "index" as it relates to the menu.  I'm thinking about "index" as it relates to the array that stores everything.  So you're exactly right when you want to get the "actual" indexed item from within the array.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 26, 2010, 04:29:59 PM
Do the subs check to make sure that there's no duplicate in the list?  I see it ignores item... that keeps it from finding it again, since I'm going to be saving lists with #findid, I'll need to ignore the items as they're added to my lists when I load a list wont I?  Or is there some kind of check I haven't looked at yet?
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 26, 2010, 04:46:11 PM
Nope, that's up to you.  You will have to do the query and see if the item is there.  You can use the TM_SearchFor.... and TM_Delete.... subs to keep your list synchronized and guard against duplicates.  With tools like this, I only give you the rope; it's up to you to make a hat out of it.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 26, 2010, 06:29:48 PM
it's up to you to make a hat out of it.

The problem I'm having is wrestling with my inner demon on wether to release such an overpowerfull script, even to "the" guild... because loose lips sink ships, its one of the lessons I've learned OVER and OVER in UO... You tell one person, within a week to a month, it's going to be used and abused by that one person, and 2 of his friends, and 2 of their friends... limited only by cool factor and stupidity. :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 26, 2010, 06:41:12 PM
That's what the Elite script library is all about!  ;)
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 27, 2010, 09:49:26 AM
http://www.scriptuo.com/index.php?topic=4584.0

Link to what I've done so far.  Very basic and nothing implemented well yet... some stuff to play with tho.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 28, 2010, 06:35:08 PM
Why do I sometimes only get the ID and not the name from your code in there?  Is it a client update thing?  I've never really had problems getting #property stuff... but I've read that it will miss it sometimes?  Is there a way around that besides waits?  Maybe a if %name = n/a , no name, whatever... then delete and rescan?
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 28, 2010, 09:44:26 PM
I've got a few questions here for you.  First:  I have saved all files for 4 lists successfully.  They are on my desktop where I ran the script.  Filled with what looks like the correct info.  My problem comes from loading them.  I use this variable:

Code: [Select]
set %saveFileNameShard2 Enemy , #shard , #charname , .txt
That will not load the same file of the same name using the same variable...  I'm not using a file PATH though... does that matter?  I don't want to use a specific path, I just want it to load the file from the directory the script is in...  Second:  I've been searching and searching through the code to find the exact spot I should add an ignoreitem %tag when LOADING the files in the script.  Since the script I'm doing constantly scans... or does this happen automatically?  What I mean is, the main script finds a target, then ignores it after setting its name and tag... then I save the files.  Then if I want to load the files I have it delete all lists... then I want to LOAD all lists, and have the TAGS ignored for the loaded lists... so they don't get scanned for AGAIN after loading... does that make sense? :)  I'm sure I have more questions but those 2 are my main focus at this point... trying to get all file operations working.  I'll throw a code snip in.

Code: [Select]
sub button_SaveEnemyList
  set #menubutton n/a
  gosub TM_SaveListToFile Newlist2 %saveFileNameShard2
return
sub button_SaveTargetList
  set #menubutton n/a
  gosub TM_SaveListToFile Newlist1 %saveFileNameShard1
return
sub button_ExcludeList
  set #menubutton n/a
  gosub TM_SaveListToFile Newlist4 %saveFileNameShard4
return
sub button_FriendList
  set #menubutton n/a
  gosub TM_SaveListToFile Newlist3 %saveFileNameShard3
return
sub button_SAVEALL
  set #menubutton n/a
  gosub TM_SaveListToFile Newlist3 %saveFileNameShard3
  gosub TM_SaveListToFile Newlist4 %saveFileNameShard4
  gosub TM_SaveListToFile Newlist1 %saveFileNameShard1
  gosub TM_SaveListToFile Newlist2 %saveFileNameShard2
return
sub button_LOADALL
  set #menubutton n/a
  gosub TM_DeleteAllItemsInList Newlist1 #true
  gosub TM_DeleteAllItemsInList Newlist2 #true
  gosub TM_DeleteAllItemsInList Newlist3 #true
  gosub TM_DeleteAllItemsInList Newlist4 #true
  ignoreitem reset
  gosub TM_LoadListFromFile %saveFileNameShard1
  gosub TM_LoadListFromFile %saveFileNameShard2
  gosub TM_LoadListFromFile %saveFileNameShard3
  gosub TM_LoadListFromFile %saveFileNameShard4
return
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on February 28, 2010, 09:55:45 PM
I won't have time to look at this tonight.  Up to my eyebrows in work.  I'll check it out tomorrow however.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 28, 2010, 11:08:33 PM
I won't have time to look at this tonight.  Up to my eyebrows in work.  I'll check it out tomorrow however.

Maybe all I need to do is redraw the menu eh?  Gonna try that now...
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on February 28, 2010, 11:49:50 PM
Wow... I got it to save/load files.  Not sure the loading is doing what it should.  I guess as long as the actual VARIABLES load correctly tho, that's what matters.  Not how the actual lists look. :)  I'm gonna post a picture so you can see what I get.  Below is the result of loading a file?  Is that how it's supposed to look?  There's extra underscores in places.  I haven't tested if it's actually loading the variables that get saved tho and if I can still access them with the TM_getselectedtag or whatever. :)  As long as that works, I really dont care what it looks like.  Would be nice if I could put it back in the list the way I saved it.  Is that possible?  Loving these so far TM. :)  I wish I could get that damn problem with #property not updating before I get the actual name sometimes.  Only happens when I initially enter an area.

(http://i41.photobucket.com/albums/e293/BalinorUO/418525847.jpg)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 12:34:27 AM
Underscores are added in the file save function because you can't have any white space when you write out to the DOS prompt; causes issues.  You can remove the white space when you load the files back.  Just iterate through the list and run one of the "AddSpace" functions.  

Also, you might think about putting a "pretty" version of information in the "item", and all the data in the "tag".  So put the Name of the characters you see in the "item" portion, and put the #FINDID of the character in the "tag" that matches each "item".

That's what I do anyhow.

Here's a quick AddSpace function:

Code: [Select]
;-------------------------------------------------------------------------------
; %1 - string to mung
sub AddUnderscore
  namespace push
  namespace local AU
  set !tempstring %1
  AddUnderscore_loop1:
    str pos !tempstring _
    if #STRRES <> 0
    {
      set !val #STRRES - 1
      str left !tempstring !val
      set !left #STRRES
      set !val !val + 1
      str del !tempstring 1 !val
      set !tempstring !left , #SPC , #STRRES
      goto AddUnderscore_loop1
    }
  set #RESULT !tempstring
  namespace pop
return #RESULT
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 01:01:35 AM
Here's an example of what I'm talking about.  I store a little bit of information in the "item" field that visible in the listbox, but I store the #FINDID in the "tag" part.  When you click around in the first list box, it senses you've made a new request and calls "TM_GetSelectedTag" to retrieve the "tag" that you've currently selected.

Code: [Select]
set %font_arial MS , #SPC , Ariel
gosub showEUOMenu1
gosub TM_CreateList List Newlist1 4 4 345 289 White WindowText %font_arial 8
;gosub TM_CreateList List Newlist2 350 4 265 289 White WindowText %font_arial 8
menu list create Newlist2 350 4 265 289 White WindowText %font_arial 8
set #LPC 100
set %menu_sel #MENURES
repeat
  finditem * G_18
  if #FINDKIND <> -1
  {
    event property #FINDID
    str pos #PROPERTY $
    set #STRRES #STRRES - 1
    str left #PROPERTY #STRRES
    gosub TM_AddToList Newlist1 #STRRES #FINDID
    ignoreitem #FINDID
  }
  menu get Newlist1
  if #MENURES <> %menu_sel
  {
    set %menu_sel #MENURES
    menu delete Newlist2
    menu list create Newlist2 350 4 265 289 White WindowText %font_arial 8
    gosub TM_GetSelectedTag Newlist1
    event property #RESULT
    gosub TM_SplitString #PROPERTY $
    set %lines #RESULT
    if %lines > 0
    {
      set %lines %lines - 1
      for %i 0 %lines
      {
        gosub TM_GetIndex %i
        menu list add Newlist2 #RESULT
      }
    }
  }
until #FALSE
;-------------------------------------------------------------------------------
sub TM_SplitString
  namespace push
  namespace local PS
  namespace clear
  set !string %1
  set !delimiter %2
  set !cnt 0
  set !ptr 1
  set !start 1
  set !end 1
  str pos !string !delimiter !ptr
  repeat
    if #STRRES = 0
      break
    set !len #STRRES - !start
    str mid !string !start !len
    set !array . !cnt #STRRES
    set !start !start + !len + 1
    set !cnt !cnt + 1
    set !ptr !ptr + 1
    str pos !string !delimiter !ptr
  until #STRRES = 0
  set #RESULT !cnt
  namespace pop
return #RESULT
;-------------------------------------------------------------------------------
sub TM_GetIndex
  namespace push
  namespace local PS
  set !index %1
  set #RESULT !array . !index
  namespace pop
return #RESULT
stop
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 01, 2010, 01:03:11 AM
That's exactly what I do. :)  I only have the name/id in the menu for debugging.  Soon as I finish, I'll take out the id, and maybe shrink the window panes for ease of use, and to conserve window/desktop space.  Lengthen the windows a bit to fix more names... find a way to add NUMBERS to the list... then who knows.  You got an easy way up your sleeve to add hard coded numbers to each list item? :)  That would ROCKKKK.  Makes calling a target SO easy if you have people not using the server option.  You just say TARGET 5 DAMNIT! :)  The only problem I have with that is everyone will have to be using the same LISTS.  But the way I'm doing this, if 2 guys are fighting in 2 different areas... and you have a guy on your list that he DOES NOT HAVE, you can STILL send him your target info... and vice versa if you switch to the server... :)  This should be as universal as you can make something like this...
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 01, 2010, 01:08:47 AM
I'm not gettin that example tho. :)  It's early...
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 01:16:53 AM
I'm not gettin that example tho. :)  It's early...

Probably the split string is throwing you.  I'm just using that function to split a string up into sub-strings that are separated with the "$".  So that'll let you iterate through all the property lines in a property and that's how I'm displaying each line by displaying lines:

gosub TM_SplitString #PROPERTY $
gosub TM_GetIndex 0 ; get line 1
gosub TM_GetIndex 1 ; get line 2
gosub TM_GetIndex 2 ; get line 3
gosub TM_GetIndex 3 ; get line 4
etc.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 01, 2010, 08:44:40 AM
Ok, so I added spaces back into the lists and it looks great. :)  Thank you.  So now where do I find the !tag variable when you're reloading a saved list?  I want to ignoreitem all the loaded !tag vars on reloading so the script doesn't search for them again and add them twice to the lists...  I looked and looked.  Seemed like it might be in TM_ReadVariables where it's reading the variables from the files loaded.  I added an event exmsg !var there to see and it looks as if that's loading all the variables with one sub... ns_name and tag and all of it...  so how can I seperate out the !tag variable while it's loading and ignoreitem on it?  There's got to be an easy way there...  I just can't figure it out.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 01, 2010, 08:50:12 AM
Gah, forget that, I'll just iterate through the list before it goes back to the scan sub and for loop through the tags and ignore them one by one.  Sound right? :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 09:19:47 AM
Yup that's right.  Remember these are just list handling subs.  However you want to implement your stuffs is up to you.  So just let the TM_ subs do their thing and then go back and write a set of subs that uses the data enclosed.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 01, 2010, 10:24:28 AM
Yup that's right.  Remember these are just list handling subs.  However you want to implement your stuffs is up to you.  So just let the TM_ subs do their thing and then go back and write a set of subs that uses the data enclosed.

I just thought maybe I could catch the data in one of your subs and save a step. :)  A simple ignoreitem %var or something in the right spot to do it for me. heh  Oh well.  These are so nice.  Thanks again for writing this TM. :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 10:36:04 AM
...These are so nice.  Thanks again for writing this TM. :)

You're welcome.  I love writing tools like this. 
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 01, 2010, 12:31:40 PM
Any idea why this doesn't work? It's nice going right to the source... You'd be shocked how long I've spend trying to figure this out.  Ugh.

Code: [Select]
sub button_MoveAll
  set #menubutton n/a
  menu get comboMoveTo
  set %comboMoveTo #menures
  if %comboMoveTo = 1
    set %moveToList Newlist1
  if %comboMoveTo = 2
    set %moveToList Newlist2
  if %comboMoveTo = 3
    set %moveToList Newlist3
  if %comboMoveTo = 4
    set %moveToList Newlist3
  menu get comboMoveFrom
  set %comboMoveFrom #menures
  if %comboMoveFrom = 1
    set %moveFromList Newlist1
  if %comboMoveFrom = 2
    set %moveFromList Newlist2
  if %comboMoveFrom = 3
    set %moveFromList Newlist3
  if %comboMoveFrom = 4
    set %moveFromList Newlist4
  event exmsg #charid 3 0 %moveFromList , #spc , %moveToList
  gosub TM_CopyAllItemsInList %comboMoveFrom %moveToList #TRUE #TRUE
  gosub TM_DeleteItemsInList %comboMoveFrom #TRUE #TRUE
return
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 12:44:01 PM
What does it do exactly?
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 01, 2010, 01:05:21 PM
What does it do exactly?

I just have 4 lists.  And this will select the list to move all items to by a dropdown menu.  I want it to copy ALL items and ns_name and tag to one menu from another.  Say from Enemy List, to the Target List...  or Friends List to the Target List or vice versa.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 01:14:57 PM
Ok, we'll I'll have a chance this evening to look at it.  I'm at work right now.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 05:59:35 PM
Ok, so my question stands.  What's it doing?  I mean you probably should put some safeguards in to be sure you have two menus selected.  Because a #MENURES of 0 will pass through and cause unknown strangeness.  I'll run my sample code in a bit; I haven't used the copy commands for a while and I don't have anything that presently uses those.

Also, are you wanting to append to the list or clear out the destination?
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 01, 2010, 06:14:50 PM
Ok, so my question stands.  What's it doing?  I mean you probably should put some safeguards in to be sure you have two menus selected.  Because a #MENURES of 0 will pass through and cause unknown strangeness.  I'll run my sample code in a bit; I haven't used the copy commands for a while and I don't have anything that presently uses those.

Also, are you wanting to append to the list or clear out the destination?

There can only BE 2 menus selected because I preselect a menu for each one in the menu sub... :)  What I think will be the most common.  I'm trying to move items from one list to another while appending them on to what's already there.  It would be AMAZING to be able to move things up and down a list too... for greater organization. :)  heh  The list names are just like your naming in the subs.  Newlist1...2...3...4,  and I want to be able to freely move the name and tag between all the menus by 2 dropdown boxes and a button to move the selected item...  Do I need to get selected tag/item, set them to variables, then delete the item and additem to the other menu? 

The snippet tho is just to copy all items from one menu to another by dropdowns and button.  I have a move all, and move selected button that both work with the dropdowns.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 06:22:02 PM
Ok, so is it copying?  appending?  barfing blood?  What?
From what it looks like, your sample code should work.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 06:59:31 PM
Well, it seems to copy over just fine.  I ran my "tweaked" test code you find commented out.  Just single step through it "F8"

Code: [Select]
set %font_arial MS , #SPC , Ariel
gosub showEUOMenu1
pause
gosub TM_CreateList List Newlist1 10 10 100 100 White WindowText %font_arial 8
gosub TM_LoadListFromFile c:\testlist.txt ; load a list from file
gosub TM_ReDrawList Newlist1 ; redraw list
gosub TM_CreateList List Newlist2 110 10 100 100 White WindowText %font_arial 8
gosub TM_AddToList Newlist1 alpha TAG
gosub TM_AddToList Newlist1 gamma TAG
gosub TM_AddToList Newlist1 beta TAG
gosub TM_AddToList Newlist1 monkey TAG
gosub TM_AlphabetizeList Newlist1 >
gosub TM_ReDrawList Newlist1 ; redraw list
gosub TM_AddToList Newlist2 monkey TAG
gosub TM_DeleteItemsInList Newlist1 beta #TRUE #TRUE
gosub TM_CopyAllItemsInList Newlist1 Newlist2 #TRUE #TRUE
gosub TM_SaveListToFile Newlist1 c:\testlist.txt
stop

;--------- EasyUO Menu Designer Code Begin ---------
sub showEUOMenu1
menu Clear
menu Window Title Test
menu Window Color BtnFace
menu Window Size 442 298
menu Show 421 270
return
;--------- EasyUO Menu Designer Code End ---------
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 01, 2010, 08:14:43 PM
I'm sure I sent it to you in a pm.  If not I'll send it again in a day or two and you can run it and see for yourself.  It's just not doing a thing really... maybe it's not liking the variables instead of the list names themselves?  I don't know why it wouldn't work... It's got to be syntax or spelling and I've checked it over and over.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 01, 2010, 08:17:05 PM
Did you try running the sample code?
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 04, 2010, 08:16:50 PM
Ok, where would I go about finding a good spot to ignore the #findid's of all the people in my saved lists when I load them?  It looks like it parses the info out of the file, and I can't see a good way to do this...?  Any help would be appreciated. :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 04, 2010, 08:19:40 PM
Right after you load the list, just go through all the items and ignore them.  Best to not modify my subs, but iterate your list contents with your own functions.  Best to never modify subs you use so if I do find a bug, you can update your code easily.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 05, 2010, 09:59:13 AM
Right after you load the list, just go through all the items and ignore them.  Best to not modify my subs, but iterate your list contents with your own functions.  Best to never modify subs you use so if I do find a bug, you can update your code easily.

Would you quit being so logical and let me take the easy way out once in a while?  GOSH. :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 08, 2010, 08:09:56 PM
Ok, I added to functions:

;   TM_MoveSelectedItemDown
;   TM_MoveSelectedItemUp

Each one has 3 arguments.  %1 = list name, %2 = redraw, %3 = highlight.  Test code included!

Only for selected items so far, not for indexed items at the moment.  I'll add indexed later.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 08, 2010, 08:34:20 PM
SWEET.  I think I'll wait for the indexed one.  That's the badboy I need I'm thinkin. :)  I've run into a list loading/saving problem now too.  I think it's my fault tho.  Grrr.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 08, 2010, 08:36:41 PM
I just knocked off the hard one first.  Indexed is easier.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 08, 2010, 11:45:36 PM
ok, I added the indexed ones.  Remember the index starts at 0.  ;)  Note it returns #TRUE if the move was successful, otherwise #FALSE.

The arguments are:

gosub TM_MoveIndexedItemDown Newlist1 #MENURES #TRUE #TRUE

%1 - listname
%2 - index to move up/down
%3 - redraw
%4 - highlight
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 05:31:36 AM
You sir, are a steely eyed missle man. :)  That is exactly what the doctor ordered. onHotKey (user_key) gosub TM_moveIndexedItemUp/Down...?  Yum. :)
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 08:40:30 AM
Hey, if I change the naming of menu items in the list IN your subs, does that affect the saving and loading of variables from the files?  I'm assuming yes...  These two edits are what allow me to number the lists, but it SEEMS like occasionally I'm getting a save/load error.  When I set it back to normal, it seems like loading/saving works fine again, then readding these vars will make numbering the lists work again until the saving/loading error hits again.  The error makes one list out of the four I have, either not save, or NOT load, and it seems random...?  I know you said dont want to support me editing your subs, but this was the easiest way for me to add list numbering...  2 little edits.  If it messes with your subs tho, I'll take it out in a heartbeat.  Just wondering what you think here, or if there's another way, or if maybe there's something we can do to fix it so this actually works?

Example is commented:

Code: [Select]
sub TM_DrawList
  namespace push
  namespace local TM_window_list_ , %1
  set !temp2_LPC #LPC
  set #LPC 1000
  set !listname %1
  menu Font BGColor !bgcolor
  menu Font Color !txtcolor
  menu Font Size !fontsize
  menu Font Name !font
  if !fontstyle = N/A
    menu Font Style
  else
    menu Font Style !fontstyle
  menu !listtype create !listname !x1 !y1 !x2 !y2
  set !end !list_ptr - 1
  if !end >= 0
  {
    for !i 0 !end
      menu !listtype add !listname !i !list . !i  ;Add !i between !listname and !list
  }
  set #LPC !temp2_LPC
  namespace pop
return

Code: [Select]
sub TM_AddToList
  namespace push
  namespace local TM_window_list_ , %1
  set !listname %1
  set !item %2
  set !tag %3
  set !list . !list_ptr !item
  set !tag . !list_ptr !tag
  set !list_ptr !list_ptr + 1
  set #RESULT !list_ptr
  if %addBreakNum = #true
    goto _skipAddBreak_:
  set %newNum !list_ptr - 1
  menu !listtype add !listname %newNum !item ; Add %newNum between !listname and !item
  goto _skipAddBreak1_
  _skipAddBreak_:
  menu !listType add !listname !item
  _skipAddBreak1_:
  namespace pop
return #RESULT
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 09:34:59 AM
Now I see why EN insists on calling his subs so hackers like you don't kill them.  If I find a bug, you won't easily be able to update.  I wouldn't.

Seriously though, just make a copy of the sub and do what you want to it.  I don't really care.  Just know that you may fall behind the times as updates come out and it'll make it harder for you to update.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 10:00:08 AM
Oh oops, forgot to post it...  lol
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 10:03:10 AM
Now I see why EN insists on calling his subs so hackers like you don't kill them.  If I find a bug, you won't easily be able to update.  I wouldn't.

Seriously though, just make a copy of the sub and do what you want to it.  I don't really care.  Just know that you may fall behind the times as updates come out and it'll make it harder for you to update.

Hey, I just want numbered lists to work without slowing down how speedily this works. :)  Those 2 little edits were the easiest way.  I'm mainly doing it that way to learn how it works so I can do it myself.  Not to annoy you. :)  I wont release anything with edits to your subs. heh  And if I DID cause it fit better what I used, I'd be sure to put a link to your UNEDITED version so you wouldn't have to support my crappy hacks of your code. haha  And specify that it's edited and DONT USE IT cause TM will be annoyed if he has to support my hacks you'll hear about it. haha  I did say I want to do it without editing your sub if you have a good idea on how I should go about that?  That's kind of what I was asking... :)  I guess every time I could iterate through every list and number them, but that just seems like it's not very optimal.  Maybe do a redraw of the lists after every operation and not use the redraw in the individual subs, but I was looking for input from the list master.  Just think tho, after all my list hoohaa you wont ever have to answer a question in this thread again.  They'll all be covered.  :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 10:08:58 AM
Na don't worry.  I'm just busting your chops.  After yesterday, it's nice to play around.  heh
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 10:27:25 AM
Na don't worry.  I'm just busting your chops.  After yesterday, it's nice to play around.  heh

Well then play around with numbered lists.  Have fun with that. :)  Personally I think it should be an OPTION in your subs. :)  Make them that much more usefull...  Pretty slick how it works too, and numbers them perfectly even when moving/deleting/adding... I love that.  I've been scanning through the loading/saving to see where I'm missing something but yea... um.  No. :)  I don't have xray code vision sadly.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 10:29:52 AM
Probably the worst thing that'll happen with DOS/command line saving is that some character in the line is messing up the save process.  With people and their strange characters in their names, I'm not surprised.  I'm creating a whole new file system for EUO, but have been bogged down by real life.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 10:37:37 AM
Hey, I'm also still having the list loading/saving problem after removing ALL edits and using your newest subs.  It's something in your subs.  I'm accessing them correctly.  Unless it has to do with reloading with the add space sub?  Then resaving?  That's the only thing I can think of but that shouldn't keep it from working correctly.  It's only not loading and saving one sub occasionally... Strange.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 10:40:41 AM
Read my last post.  If you just save/load normal text, then it works fine.  There's probably a strange character that's messing up the command line.  Guild names generally have odd characters.  You may have to modify the list process to strip off all the guild information.

There's nothing I can do about this, it's a DOS/command line thing.  The only thing you can do is control what text is saved.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 10:44:07 AM
Gah.  Speed posting.  Sorry I'll look at it more.  If it's just an odd character, I'll parse out guild names if I can, but I LIKE having it in there. :)  Sucks.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 10:49:58 AM
Well I'm working on a whole new filesystem for EUO.  Something that you can copy/paste information from different scripts, view variables throughout the filesystem and all based on character instances.  It's pretty wild.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 11:54:16 AM
Side note here on the saving/loading issue.  I added a drop down box for saving and loading so I can save and load lists individually, not just all at once.  Now if a list doesn't load, I can load that list individually and it loads fine... kinda makes you think there's a problem loading them all at once?  Not sure it's me as my load sub is pretty straight forward and simple using all your subs.  Just a load button.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 12:48:30 PM
Not sure really.  I haven't played much with the load/save since I wrote them.  I'm not sure when I'll have time to do much debugging with it.  Perhaps this weekend.  Should work fine since this is the same file system (cut/paste) that's working in many of my other scripts.   Dunno.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 01:58:37 PM
I cut and pasted your new version into the script over my edits and it still did it wether I edited it for numbering or not.  Now that I have loading of single files and saving of single files at least there's a workaround. :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 06:44:35 PM
One thing I noticed.  You need to store 1 list per file.  It's an odd limitation and I could go into the mechanics of it, but I choose not to.  So just save your lists in separate files.

I would have to write a sub to write everything to one file.  It's definitely possible with the existing filesystem.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 06:53:02 PM
One thing I noticed.  You need to store 1 list per file.  It's an odd limitation and I could go into the mechanics of it, but I choose not to.  So just save your lists in separate files.

I would have to write a sub to write everything to one file.  It's definitely possible with the existing filesystem.

Did you see something?  Cause I have 4 files.  One for each list... but I notice a 5th popup when I'm saving sometimes...?  That have something to do with it?
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 07:06:46 PM
That's just an optical illusion.  Sometimes I notice the dos box pop up quicker too, I'm not sure what magic Cheff uses, but he certainly made it annoying to do things like this.  No, the problem comes because you are embedding the namespace in the save file, but only one namespace per file.  Since each list requires it's own namespace, it predicates 4 files.  Also remember that each line can only be 2K long.  There might be times when you exceed this and will cause 2 writes.  Basically the DOS prompt sucks ass but it's the only thing Cheff left us with.   My new file system will fix everything and avoid all the annoyances.  My subs are fine, yours are fine, it just needs another sub to bring everything together.  In the mean time, just save each list to different files.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 09, 2010, 07:11:01 PM
That's just an optical illusion.  Sometimes I notice the dos box pop up quicker too, I'm not sure what magic Cheff uses, but he certainly made it annoying to do things like this.  No, the problem comes because you are embedding the namespace in the save file, but only one namespace per file.  Since each list requires it's own namespace, it predicates 4 files.  Also remember that each line can only be 2K long.  There might be times when you exceed this and will cause 2 writes.  Basically the DOS prompt sucks ass but it's the only thing Cheff left us with.   My new file system will fix everything and avoid all the annoyances.  My subs are fine, yours are fine, it just needs another sub to bring everything together.  In the mean time, just save each list to different files.

How about not saving as a .txt file after switching characters? :)  I'm having that issue atm... When I switch from a blue guilded faction char to a red guilded faction char... one saves his lists as (ListName)(ShardName)(CharName).txt the other saves it as same but without the .txt extension... wth? :)  On a side note:  It HAS worked with him, and I haven't changed anything between loading and saving lists with him..?
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 09, 2010, 07:24:47 PM
That's an implementation thing really.  I just care about a filename and a listname for save and only filename for load.  After that, it's independent of your implementation.  That's the nice thing about tools, I just write'em.  but the mantra of tools is just to keep them generic.

I don't really know how it could have worked with 4 lists and one file.  I've been drinking a bit at the moment, so my analytical skills are a bit impaired.    I think you just got lucky.  :p
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 10, 2010, 07:13:56 AM
That's an implementation thing really.  I just care about a filename and a listname for save and only filename for load.  After that, it's independent of your implementation.  That's the nice thing about tools, I just write'em.  but the mantra of tools is just to keep them generic.

I don't really know how it could have worked with 4 lists and one file.  I've been drinking a bit at the moment, so my analytical skills are a bit impaired.    I think you just got lucky.  :p

TM WAKE UP. :)  It's saving as a name, and #SHARD, and #CHARNAME and then .txt.  So it's unique per char per shard. :)  The problem is it's not saving the same for all chars.  It's cutting off the .txt extension for some.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 10, 2010, 10:18:16 AM
Lol, I didn't possess you and force you to save that way.  Look at the sample code, I use:

gosub TM_LoadListFromFile c:\testlist.txt ; load a list from file

So it's up to you to use them.  Do a scan of the list functions.  You won't find a single reference to #SHARD or #CHARNAME.  If you're code is doing that, then it's been possessed!

Like I said, I write the tools, you hack them... :p
Title: Re: TrailMyx's List Handling Subs
Post by: 12TimesOver on March 10, 2010, 10:24:32 AM
Like I said, I write the tools, you hack them... :p
Hehe...

And you're a little bit country, I'm a little bit rock-and-roll!

:D
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 10, 2010, 10:25:36 AM
Lol, I didn't possess you and force you to save that way.  Look at the sample code, I use:

gosub TM_LoadListFromFile c:\testlist.txt ; load a list from file

So it's up to you to use them.  Do a scan of the list functions.  You won't find a single reference to #SHARD or #CHARNAME.  If you're code is doing that, then it's been possessed!

Like I said, I write the tools, you hack them... :p

Sometimes I wonder if you're the one ACTUALLY coding the stuff you code.  hehe  All I'm doing is setting a variable so the name of the text file can be unique for each char on each shard. :)  Then I call the %var.  That SHOULD work fine shouldn't it?  I can switch to another char on the same shard in the same guild and it will drop the .txt extension when saving the file..  Example below.  Is it a file name thing?  Why would it drop the .txt?  Do I need to clean up the name so there's no wierd characters in it? :)

Code: [Select]
 set %saveFileNameShard1 c:\EUO\Target , #shard , #charname , .txt
  set %saveFileNameShard2 c:\EUO\Enemy , #shard , #charname , .txt
  set %saveFileNameShard3 c:\EUO\Friend , #shard , #charname , .txt
  set %saveFileNameShard4 c:\EUO\Potential , #shard , #charname , .txt

  if %saveSelected = 1
    gosub TM_SaveListToFile Newlist1 %saveFileNameShard1
  if %saveSelected = 2
    gosub TM_SaveListToFile Newlist2 %saveFileNameShard2
  if %saveSelected = 3
    gosub TM_SaveListToFile Newlist3 %saveFileNameShard3
  if %saveSelected = 4
    gosub TM_SaveListToFile Newlist4 %saveFileNameShard4
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 10, 2010, 10:28:53 AM
That's a good place for the #DOT operator:

 set %saveFileNameShard1 c:\EUO\Target , #shard , #charname , #DOT , txt

The problem might be you are switching to a shard that has a space in it i.e. "Napa Valley".  Just have to blame EUO for it's wonky string handling.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 10, 2010, 10:31:25 AM
Ok you're the most loved child again.  I knew it was something like that.  I've actually read that 100 times just never had an opportunity to use it until now.  Thanks. :)  Should I run the file name var through the space to mung sub and back when loading/saving?  I was kidding up there a bit, I thought you were still tipsy from the night before. heh

Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 10, 2010, 10:38:09 AM
Should I run the file name var through the space to mung sub and back when loading/saving?


Probably should do something like that.  Sometimes I just don't know how EUO is going to react or how its going to effect the DOS box.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 10, 2010, 10:52:58 AM
Should I run the file name var through the space to mung sub and back when loading/saving?


Probably should do something like that.  Sometimes I just don't know how EUO is going to react or how its going to effect the DOS box.

Wouldn't that be a good addition to your subs since it's in there anyways?  Just add a check for spaces in the filename in the save sub and uncheck spaces in the load sub?  If not it's an easy thing for me to do anyways.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 10, 2010, 11:48:12 AM
Well like I said, I don't put any restrictions on HOW you use them.   A filename is a filename.  I can't really defend against all the strangness that EUO presents, but I can present the basics for everyone to use.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 10, 2010, 12:04:05 PM
Well like I said, I don't put any restrictions on HOW you use them.   A filename is a filename.  I can't really defend against all the strangness that EUO presents, but I can present the basics for everyone to use.

I'll just K.I.S.S. it as EN would say.  Take all that crap out of the names, but I want it to be unique per char, per shard.. hmmm  maybe base it on charid... and drop the shard name? :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 10, 2010, 12:13:51 PM
I have shifted to #CHARID more and more.  I'll be heavily relying on that when I release my new filesystem.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 10, 2010, 12:36:55 PM
I have shifted to #CHARID more and more.  I'll be heavily relying on that when I release my new filesystem.

Thanks for pushing me in the right direction.  That seems to have fixed all my save/load problems. :)
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 12, 2010, 12:08:23 PM
You think in the next version of your list handling subs that you're working on you could make an easy way to find and change the color of a list item? :)  Not the entire list, but individual items.  Maybe store another var? :)  So you can just check it and change it and reset/redraw it...? :)  I've been thinking of a good way to do that with your list subs now, and scanning id's to see if any are onscreen so I can color the ones onscreen to a seperate color.  Then when they leave the screen, reset their bgcolor to white.  Would be easier to have it built in.  As it is now I have to change it and redraw every time I do something.  It's a pain because I have to do it in each individual sub and redraw the menu.  Be nice to have a TM_ChangeListItemColor sub. :) One that stores the color so it persists when you organize menu elements.  Also, what's the fastest way to access all the !tag vars in a list?  For scanning purposes?  I want to iterate through them in the fastest way possible.  Would it just be a for %i 1 %TotalTags?  Using your get tag sub?  I want to use all the id's in a %finditem to see if they are on screen and if they are, color each individual tag in the list to a seperate color.  Be nice an easy with a set list item color sub. :)  for/if sub that changes color of items found in scan, and changes back if not found.  Simple.  Can you even change the background of INDIVIDUAL list items?  I was pretty sure you could... haven't tested yet... I know you can change the background color of the list itself...
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 12, 2010, 12:22:47 PM
Remember you can't change the color of individual items in a list.  You are limited by the same limitations that EUO has. 
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 12, 2010, 12:53:28 PM
Remember you can't change the color of individual items in a list.  You are limited by the same limitations that EUO has. 

YOU DIDNT EVEN READ THAT WHOLE POST! haha I knew you were doing that...
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 12, 2010, 12:56:17 PM
Heh, sorry.  I'm a paragraph spaced kinda guy.  If a subject isn't broken up into chunks, I tend to give up after the first answer.  ;)

I'll check out the rest of it this evening; at work at the moment.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 12, 2010, 09:58:56 PM
Version 0.29 added the call sub wrapper so these subs may now be called or gosubed.  Your choice.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 12, 2010, 10:05:43 PM
Heh, sorry.  I'm a paragraph spaced kinda guy.  If a subject isn't broken up into chunks, I tend to give up after the first answer.  ;)

I'll check out the rest of it this evening; at work at the moment.

And I should do my homework a bit more before asking silly questions. :)
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 13, 2010, 10:25:28 AM
Hey is there an easy way to check somethings relative location in the actual LIST WINDOW? :)  Say like you have a list that can only fit 10 things in the window, and you scroll down to where 10 is the top one.  Is there a way to check that?  And see where say 12 is located in the window itself?  So that maybe I could do a scan and set a flag that adds a green mark on the side of the window to tell you the person/item/thing is on your screen?  See what I mean?  So if 12 thru 22 are SHOWING and visible in the window, it would be scanning 12 thru 22's tags to see if they are available for action?  I can't think of a way this would be possible.  Since you're the list master tho thought you might have an idea. :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 13, 2010, 12:08:05 PM
Not an easy way really.  Since a list can only have one background color, one foreground color and one selection, it will kinda limit you.  What you might think about doing is create some graphics blocks that align with the list contents and place that to the left of the list.  Problem with that kind of graphic handling is that EUO is really slow handing that.  EUO Lists are VERY basic; there is no way to determine what list index is visible.  Only what is selected.

You could create another list and periodically scan the master list, and update the new list to shot what's visible.  That'll take a lot of EUO horsepower to make it look pretty.  It's times like this where I wish I did more in UOMachine because using Windows Forms makes that kind of UI much easier to implement.

I'm sure Cheffe will be adding those new features soon.  :p
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 13, 2010, 12:33:44 PM
What you might think about doing is create some graphics blocks that align with the list contents and place that to the left of the list.  Problem with that kind of graphic handling is that EUO is really slow handing that.  I'm sure Cheffe will be adding those new features soon.  :p

That's exactly what I was thinking... scan for the people that are currently within scan range and visible in the list so you knew EXACTLY who was visible when glancing at the list.  To make it easier to select relevant targets.  Maybe have a relevant target list then.  Have an "enemy list" tab on the right, and a "relevant enemy" list tab also... the relevant list would constantly update based on targets within range...? :)  Could really hurt ya tho at say a UO event... or on a bigger shard with TONS of people on screen.  I gotta really do something about that.  With as many targets as I have, it's getting to be annoying scrolling through the list even with my macro keys I setup.  I'll send you the newest version in PM so you can see what I mean.  You wanna see my list also?  I got about 250 people in it.  Might be interesting for ya. :)
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 13, 2010, 12:34:56 PM
Hey my biggest list is around 15k... is there a limit at all?
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 13, 2010, 12:37:59 PM
You need to figure out a way to widdle that list down to people that you KNOW you want to track instead of tracking everyone in a list.  You need a non-visible ignored list or something like that.  There just can't be 250 toons engaged in your silly PvP stuff.  :p
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 13, 2010, 12:38:57 PM
Hey my biggest list is around 15k... is there a limit at all?

Heh, no limit other than your patience when saving!  That'll get alot faster when I adapt my new file system to these subs.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 13, 2010, 12:48:29 PM
You need to figure out a way to widdle that list down to people that you KNOW you want to track instead of tracking everyone in a list.  You need a non-visible ignored list or something like that.  There just can't be 250 toons engaged in your silly PvP stuff.  :p

Yea I know.  I haven't really done any optimizing of the list filters since I initially did them.  There's TONS of room for that still.  Like completely ignoring all npcs and such.  All non essential pets.  That kind of thing.  I just haven't got around to it yet.  I wanted to make absolutely sure the list functions were working as someone would expect tho.  Just in case someone decided to take it to an extreme like that. :)  I was JUST considering another way of doing it actually, that's why I was asking about marking relevant targets and such.  I might get rid of the "enemy" list completely and just have all RELEVANT targets in the target list, and set a timer for them for like 1 hour. :)  No reason they should still be in the list after that if you're doin your job right anyways. hehe  Maybe robust up the part where you can select them by guild name and such.  Because I have that in there.  User tag input?  Who knows.  There's so many options with this it's crazy actually. :)  I don't want to move forward tho until I get a good idea of where I want to go from here.  With your tabbed stuff and new save/load file system, I might just halt until that's all done.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on March 13, 2010, 12:52:19 PM
By the way, ever since I started saving with filename(#charid) instead of filename(#shard)(#charname)... the loading/saving works flawlessly.  No issues so far and I've left the list running in between switching chars for days of game play then saved... no issues.  One nice little thing I thought of was setting the filename in the beginning of the script allows me to logon to my red, log out, goto luna with a blue, get all chars in the list I want, and still save it under my reds character id. :)  So he can have a nice handmade list without having to do it all in the field. heh
Title: Re: TrailMyx's List Handling Subs
Post by: Khameleon on March 13, 2010, 12:54:21 PM
saving files with shard name can be tricking since some shards have two words.. spacing issues with EUO.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 13, 2010, 01:38:03 PM
...One nice little thing I thought of was setting the filename in the beginning of the script allows me to logon to my red, log out, goto luna with a blue, get all chars in the list I want, and still save it under my reds character id. :)  So he can have a nice handmade list without having to do it all in the field. heh

One of the many nice things a working list manager brings!  Toolz are coolz!
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on August 11, 2010, 06:36:02 AM
Soooooooooooooooooooooooo......... seriously waiting on these to do a big project.  :)  *whistles*
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on August 11, 2010, 07:11:49 AM
Sorry, first attempt failed.  Haven't had a chance to debug why.
Title: Re: TrailMyx's List Handling Subs
Post by: Scrripty on August 11, 2010, 07:14:24 AM
Sorry, first attempt failed.  Haven't had a chance to debug why.

Well whip those bad subs into shape.  They're taunting you... :)
Title: Re: TrailMyx's List Handling Subs
Post by: OMGBurgers on March 25, 2011, 06:56:59 PM
can the save/load subs in this script be edited from:
gosub TM_FileSystem_SaveVariable local TM_window_list_ , !listname save_handle listtype

to use the NGFS subs and work properly?  I'm guessing I can just change the gosub argument to say the correct thing (without the misspell!) and update the call arguments accordingly.

Of course by change, i mean copy the subs, and create NGFS ones.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on March 25, 2011, 08:02:28 PM
It's possible, but certainly you are going to probably have a few head-banging sessions.  That even scares me.  ;)

This is one of those scripts I need to transition to the NGFS.
Title: Re: TrailMyx's List Handling Subs
Post by: altiric on July 08, 2021, 08:44:52 PM
Was putting together a script involving lots of complicated lists and after getting all the way to wanting to remove an item from the list, i stumbled across this beautiful piece of work :)

Managed to get everything working after looking through it enough times, just having one issue saving multiple lists into one file. Just as an example, im making a list with mob name as the item, id as the tag, listname as the dungeon.

Code: [Select]
gosub TM_LoadListFromFile %savefile

gosub TM_CreateList List covetous 252 24 137 173 Gray White Verdana 8
gosub TM_AddToList covetous Harpy ABC
gosub TM_AddToList covetous Mongbat ABC
gosub TM_AddToList covetous Skeleton ABC
gosub TM_SaveListToFile covetous %savefile

gosub TM_CreateList List destard 252 24 137 173 Gray White Verdana 8
gosub TM_AddToList destard Dragon ABC
gosub TM_AddToList destard Drake ABC
gosub TM_AddToList destard Wyvern ABC
gosub TM_SaveListToFile destard %savefile

If i run that in any combination of ways, i only end up keeping the last list saved. I could save each dungeon to a file but this seems like a cleaner way if possible.

Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on July 08, 2021, 11:58:49 PM
I forgot about this version.  lol.  I forgot the list subs originally started out saving to a flat file.  The later versions of these subs saved to the registry to be much faster than these.  I'll attach version 31 which is the latest version of the registry version if you'd like to play with that.

For your problem, it looks like it's not possible to save multiple lists to a single file.  It's easy to add however.  I'd recommend gutting the "TM_SaveListToFile" pulling out the header save and then just appending the info.  I might have a little time to put together a sub that will do this over the weekend if you're willing to wait.  I'll probably just create a sub called "TM_AppendListToFile"
Title: Re: TrailMyx's List Handling Subs
Post by: altiric on July 09, 2021, 10:34:11 AM
Got it all working based on your suggestion :)
I did have to edit FileSystem_SaveFile as well since it created a file by default. Once that was all working i did end up going with the newer version. Makes it less portable but quite a bit more powerful. With all the TM_'s in my script already, its looking a lot more like your script than mine lol

With your help though, ive been able to create a combo box with all slayers in my inventory that can auto swap based on combobox selection. It also has quite the fancy target list that holds things like champ spawns, dungeons, and custom target lists that are all editable. The part im adding now is the ability to find a slayer type based on target #FINDTYPE, and automagically swap to that slayer if its in my inventory. I have a number of bird, repond, and undead targets working perfectly already. This functionality should work for a warrior selecting weapons, mages spellbooks,  and a bard to choose an insrument. The script also handles auto buffs, cross healing, autofollow, honor/attack, discording/peacing, all that fun stuff to save some carpal tunnel syndrome :)
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on July 09, 2021, 02:05:12 PM
Very nice!  I'm glad you figured it out.  Yeh, the loss of portability is very annoying, but the speed increase sort of makes up for it.

Sounds like you have a pretty nice script going.  I'm glad you're using the tools I made.  I really did them to help simplify things with the hopes of people actually creating more elegant scripts without the need to worry about the nuts and bolts.  I liken the tools I made to a nice paint assortment.  The colors are neat, but the real artwork comes from using them to create something more.
Title: Re: TrailMyx's List Handling Subs
Post by: altiric on July 09, 2021, 03:05:45 PM
No need to reinvent the wheel, especially since I was working on one for a wooden cart, and you had one for a race car just sitting around :)

I was quite happy with some of the solutions I rigged up to various problems, but using your subs just makes more sense outside of one specific sub. For example, my solution to keeping track of all the data for a variable index was sweet, but couldn't remove an item from the list, nor can euo... thats how I ended up getting into this one in the first place. I would like to get this script posted one day, I'm close to having all the framework done and the data will all depend on the user. So it's really just about tweaking a few things and finding all the little script breakers.
Title: Re: TrailMyx's List Handling Subs
Post by: TrailMyx on July 09, 2021, 03:09:30 PM
Is this something you're going to make public?  Sounds pretty interesting.
Title: Re: TrailMyx's List Handling Subs
Post by: altiric on July 11, 2021, 02:11:35 PM
That is the plan! I actually just spent the night redoing 2 of the main subs. One for finding and listing available slayers, the other for figuring out the slayer type a target is weak against. Now they should be able to pop right into other scripts if people find them handy (its sure working for this script lol). Did not add anything for the functionality of this script, but i figured it may help towards my contributions :) The data is all user defined and variable so as soon as im done the framework, it will be ready for testing.
Title: Re: TrailMyx's List Handling Subs
Post by: The Ghost on July 13, 2021, 12:04:42 PM
I forget about his sub section.    Interesting build that you are working on.   Now with the Camoe Talisman,  we need to be careful about the opposite slayer.  They sure can ruin your day when you forget about hose.   Sure will wait to see the finish result, sound promiting