Author Topic: TrailMyx's List Handling Subs  (Read 86929 times)

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's List Handling Subs
« Reply #45 on: March 01, 2010, 06:59:31 PM »
0
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 ---------
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #46 on: March 01, 2010, 08:14:43 PM »
0
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.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's List Handling Subs
« Reply #47 on: March 01, 2010, 08:17:05 PM »
0
Did you try running the sample code?
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #48 on: March 04, 2010, 08:16:50 PM »
0
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. :)

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's List Handling Subs
« Reply #49 on: March 04, 2010, 08:19:40 PM »
0
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.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #50 on: March 05, 2010, 09:59:13 AM »
0
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. :)

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's List Handling Subs
« Reply #51 on: March 08, 2010, 08:09:56 PM »
0
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.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #52 on: March 08, 2010, 08:34:20 PM »
0
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.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's List Handling Subs
« Reply #53 on: March 08, 2010, 08:36:41 PM »
0
I just knocked off the hard one first.  Indexed is easier.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's List Handling Subs
« Reply #54 on: March 08, 2010, 11:45:36 PM »
0
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
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #55 on: March 09, 2010, 05:31:36 AM »
0
You sir, are a steely eyed missle man. :)  That is exactly what the doctor ordered. onHotKey (user_key) gosub TM_moveIndexedItemUp/Down...?  Yum. :)

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #56 on: March 09, 2010, 08:40:30 AM »
0
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

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's List Handling Subs
« Reply #57 on: March 09, 2010, 09:34:59 AM »
0
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.
« Last Edit: March 09, 2010, 09:43:47 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: TrailMyx's List Handling Subs
« Reply #58 on: March 09, 2010, 10:00:08 AM »
0
Oh oops, forgot to post it...  lol
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #59 on: March 09, 2010, 10:03:10 AM »
0
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.  :)