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

0 Members and 1 Guest are viewing this topic.

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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 #15 on: February 26, 2010, 02:49:56 PM »
+1
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.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #16 on: February 26, 2010, 03:26:24 PM »
+1
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. :)

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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 #17 on: February 26, 2010, 03:34:49 PM »
+1
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.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #18 on: February 26, 2010, 04:29:59 PM »
+1
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?

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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 #19 on: February 26, 2010, 04:46:11 PM »
+1
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.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #20 on: February 26, 2010, 06:29:48 PM »
+1
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. :)

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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 #21 on: February 26, 2010, 06:41:12 PM »
+1
That's what the Elite script library is all about!  ;)
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #22 on: February 27, 2010, 09:49:26 AM »
+1
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.

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #23 on: February 28, 2010, 06:35:08 PM »
+1
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?

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #24 on: February 28, 2010, 09:44:26 PM »
+1
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

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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 #25 on: February 28, 2010, 09:55:45 PM »
+1
I won't have time to look at this tonight.  Up to my eyebrows in work.  I'll check it out tomorrow however.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #26 on: February 28, 2010, 11:08:33 PM »
+1
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...

Scrripty

  • Guest
Re: TrailMyx's List Handling Subs
« Reply #27 on: February 28, 2010, 11:49:50 PM »
+1
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.


Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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 #28 on: March 01, 2010, 12:34:27 AM »
+1
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
« Last Edit: March 01, 2010, 01:06:28 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyxTopic starter

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13301
  • Activity:
    0%
  • 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 #29 on: March 01, 2010, 01:01:35 AM »
+1
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

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
test_euo.JPG
« Last Edit: March 01, 2010, 01:06:18 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!