Author Topic: TrailMyx's Next Generation File System (TM_NGFS)  (Read 57409 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: My new filesystem - first look
« Reply #15 on: March 25, 2010, 09:00:44 AM »
+1
Oh, and another answer to your question is that since this information can be pulled from the registry, it would be very easy to implement a windows program to view and modify this information.  It's just more straight-forward to write a script for those used to just running scripts and not relying on another program.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: My new filesystem - first look
« Reply #16 on: March 25, 2010, 09:02:24 AM »
+1
!!! Do we need to ask for a release date? heh  You're not ID software, "when it's done" is not an acceptable answer. :)

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: My new filesystem - first look
« Reply #17 on: March 25, 2010, 09:11:16 AM »
+1
Probably this weekend.  I have the subs working pretty well now.  They're a bit different now.  i.e. you can add more than one variable to the monitored list:

Code: [Select]
gosub TM_RegisterVariables local std test this variable ; local:std namespace

-or-

Code: [Select]
gosub TM_RegisterVariables local std test
gosub TM_RegisterVariables local std this
gosub TM_RegisterVariables local std variable

Careful or else I'll give you a "Duke Nukem" release date.  ;)
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: My new filesystem - first look
« Reply #18 on: March 25, 2010, 09:47:46 AM »
+1
Careful or else I'll give you a "Duke Nukem" release date.  ;)
You mean "Duke Forever"?!?!?!? NOOOOOOOO!!!!!

You know what's funny TM, I was just taking stock of the subs in XIIxOveR's Miner and between your travel subs, gump and click subs, casting subs, and now soon to add these "filesystem" subs it's basically mostly your work LOL! Although, to my credit, I did replace your Click and Gumpwait subs with my own but still...

I love plug-n-play hehe.

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

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: My new filesystem - first look
« Reply #19 on: March 25, 2010, 10:03:07 AM »
+1
I've always been a big fan of utilities and generic code.  I'm glad people have found some use for it all.  ;)
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: My new filesystem - first look
« Reply #20 on: March 25, 2010, 10:09:25 AM »
+1
I've always been a big fan of utilities and generic code.  I'm glad people have found some use for it all.  ;)

I love everything you write, but I still hate the journal scanner.  When I try to use it I always mess it up. :)

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: My new filesystem - first look
« Reply #21 on: March 25, 2010, 10:15:53 AM »
+1
The journal stuff can be annoying for sure because you have to be consciously aware of EVERY possible logical interaction.  So debugging your purposed code can be a pain.  However, once you master it, it's bulletproof.  I'm just glad I haven't had to touch journal code in a long time.  I remember my first few scripts where I handled every journal query by hand.  THAT SUCKED!!  I totally loathed journal scanning, but now it's easy peasy.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: My new filesystem - first look
« Reply #22 on: March 25, 2010, 10:52:31 AM »
+1
The journal stuff can be annoying for sure because you have to be consciously aware of EVERY possible logical interaction.  So debugging your purposed code can be a pain.  However, once you master it, it's bulletproof.  I'm just glad I haven't had to touch journal code in a long time.  I remember my first few scripts where I handled every journal query by hand.  THAT SUCKED!!  I totally loathed journal scanning, but now it's easy peasy.
Ah right, forgot to add the Journal Scan subs to that list above I'm using in the miner. ROFL!

Dang...

X
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

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: My new filesystem - first look
« Reply #23 on: March 25, 2010, 07:07:12 PM »
+1
These keep morphing!  I had a bunch of really cool ideas today when I was completely bored in a meeting today.  ;)
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: My new filesystem - first look
« Reply #24 on: March 27, 2010, 04:45:35 PM »
+1
It's coming along nicely.  I have written a file system browser that lets you see everything that's being tracked in the file system.  I've dubbed this "Next Generation File System" or NGFS.

Attached is a picture of the browser.

Right now the memory is organized into two different possible ways to save.  One is organized by #CHARID, shard and script tag.  Another one is just organized by script tag.  This way you get a way to transfer "generic information" from script to script, and also allow for data to be saved for a specific character on a specific shard.

Also, I'm partitioning the file system helper functions into user levels.  So:

tm_NGFS_base = minimal base functions to allow a script to load/save from the file system
tm_NGFS_advanced = functions to allow for file system maintenance and advanced scripting

Perhaps another level for things like formatting the file system.

Here's a snapshot of the current functions (there's some test code at the end of the snippet)
Code: [Select]
sub TM_NGFS_InitializeScript
  namespace push
  namespace local TM_NGFS
  namespace clear
  set !lpc #LPC
  set #LPC 10000
  if %0 = 0
  {
    display ok You must name your script, spaces will be converted to underscores.
    stop
  }
  set !TM_FSSIZE 1000 ; do not change this!!
  set !script_name %1
  set !args %0
  gosub AddUnderscore !script_name
  set !script_name #RESULT
  if !args = 1
  {
    gosub AddUnderscore #SHARD
    set !slot #CHARID , _ , #RESULT , _ , !script_name , _vars
  }
  else
  {
    set !slot generic , _ , !script_name , _vars
  }
  set ! . !slot
  set !varcnt 0
  set !index 0
  set !script_index N/A
  while *TM_FS . !index <> N/A
  {
    if *TM_FS . !index = !slot
    {
      set !script_index !index
      break
    }
    set !index !index + 1
  }
  if !script_index = N/A
  {
    set !script_index !index
    set *TM_FS . !script_index !slot
  }
  set #LPC !lpc
  namespace pop
  set !TM_Function_found #TRUE
return
;--------------------------------------------------------------------
sub TM_NGFS_RegisterVariables
  if %0 <= 2
  {
    display ok Not enough arguments
    stop
  }
  namespace push
  namespace local TM_NGFS
  if !slot = N/A
  {
    display ok You must name your script and also run TM_NGFS_InitializeScript first.
    stop
  }
  set !nstype %1
  set !nsname %2
  for !i 3 %0
  {
    set !var % . !i
    if !nstype ,  , !nsname ,  , !var notin ! . !slot
    {
      set !newval ! . !slot
      set ! . !slot !newval , !nstype ,  , !nsname ,  , !var , 
      set !varcnt !varcnt + 1
    }
  }
  namespace pop
  set !TM_Function_found #TRUE
return
;--------------------------------------------------------------------
sub TM_NGFS_SaveVariables
  namespace push
  namespace local TM_NGFS
  set !lpc #LPC
  set #LPC 10000
  set !outstring
  set !start 1
  set !sepcnt 1
  set !line_count 0
  set !temp_str ! . !slot

  for !i 1 !varcnt
  {
    gosub ReadItem ! . !slot
    set !nstype #RESULT
    gosub ReadItem ! . !slot
    set !nsname #RESULT
    gosub ReadItem ! . !slot
    set !var #RESULT
    if std in !nstype
    {
      set !val % . !var
    }
    else
    {
      namespace copy !var from !nstype !nsname
      set !val ! . !var
    }
    set !outstring !outstring , !nstype ,  , !nsname ,  , !var ,  , !val , 
    str len !outstring
    if #STRRES >= !TM_FSSIZE
    {
      set * . !slot , !line_count !outstring
      set !outstring
      set !line_count !line_count + 1
      set !start !start - 1
      str del ! . !slot 1 !start
      set ! . !slot #STRRES
      set !start 1
      set !sepcnt 1
    }
  }
  str len !outstring
  if #STRRES > 0
  {
    set * . !slot , !line_count !outstring
    set !line_count !line_count + 1
  }
  set * . !slot , !line_count N/A ; make sure there's nothing left at end of the list
  set #LPC !lpc
  set ! . !slot !temp_str
  namespace pop
  set !TM_Function_found #TRUE
return
;--------------------------------------------------------------------
sub TM_NGFS_LoadVariables
  namespace push
  namespace local TM_NGFS
  set !lpc #LPC
  set #LPC 10000
  set !start 1
  set !sepcnt 1
  set !line_count 0
  set !temp !slot , !line_count
  set !string * . !temp
  set ! . !slot
  set !varcnt 0
  set !continue #TRUE
  while !continue = #TRUE
  {
    gosub ReadItem !string
    if !continue = #TRUE
    {
      set !nstype #RESULT
      gosub ReadItem !string
      set !nsname #RESULT
      gosub ReadItem !string
      set !var #RESULT
      gosub ReadItem !string
      set !val #RESULT
      if std in !nstype
      {
        set % . !var !val
      }
      else
      {
        set ! . !var !val
        namespace copy !var to !nstype !nsname
      }
      set !newval ! . !slot
      set ! . !slot !newval , !nstype ,  , !nsname ,  , !var , 
      set !varcnt !varcnt + 1
    }
    if !continue = #FALSE
    {
      set !line_count !line_count + 1
      set !temp !slot , !line_count
      set !string * . !temp
      set !start 1
      set !sepcnt 1
      if !string <> N/A
        set !continue #TRUE ; still more to process
    }
  }
  set #LPC !lpc
  namespace pop
  set !TM_Function_found #TRUE
return
;--------------------------------------------------------------------
sub ReadItem
  str pos %1  !sepcnt
  if #STRRES <> 0
  {
    set !len #STRRES - !start
    str mid %1 !start !len
    set !start !start + !len + 1
    set !sepcnt !sepcnt + 1
    return #STRRES
  }
  set !continue #FALSE
return #TRUE
;--------------------------------------------------------------------
; %1 - string to mung
sub AddUnderscore
  namespace push
  namespace local AU
  set !tempstring %1
  AddUnderscore_loop1:
    str pos !tempstring #SPC
    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 , _ , #STRRES
      goto AddUnderscore_loop1
    }
  set #RESULT !tempstring
  namespace pop
return #RESULT

; Test code-------------------------------------------------------------------------

gosub TM_NGFS_InitializeScript test_script

gosub TM_NGFS_LoadVariables
stop

for !i 0 100
{
  set !test . !i !i
  gosub TM_NGFS_RegisterVariables local std test . !i
}
gosub TM_NGFS_SaveVariables
stop
;--------------------------------------------------------------------
set !test 25
set !this 35
set !variable 45
set %newvar another_value
;gosub TM_NGFS_RegisterVariables local std test this variable ; local:std namespace
gosub TM_NGFS_RegisterVariables local std test ; from local:std !test
gosub TM_NGFS_RegisterVariables local std this ; from local:std !this
gosub TM_NGFS_RegisterVariables local std variable ; from local:std !variable
gosub TM_NGFS_RegisterVariables std std newvar  ; denotes a %var
gosub TM_NGFS_SaveVariables
stop

gosub TM_NGFS_InitializeScript new_script2 generic ; make a generic copy

for !i 0 100
{
  set !test . !i !i
  gosub TM_NGFS_RegisterVariables local std test . !i
}
gosub TM_NGFS_SaveVariables

gosub TM_NGFS_InitializeScript new_script22
for !i 0 100
{
  set !test . !i !i
  gosub TM_NGFS_RegisterVariables local std test . !i
}
gosub TM_NGFS_SaveVariables
stop

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
tm_ngfs1.png
« Last Edit: March 27, 2010, 04:52:34 PM 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: My new filesystem - first look
« Reply #25 on: March 29, 2010, 11:28:07 AM »
+1
Need to know if a data set exists?

Code: [Select]
gosub TM_NGFS_DoesSaveExist new_script2
if #RESULT = #TRUE
  display ok new_script2 save exists
gosub TM_NGFS_DoesSaveExist new_script2 generic
if #RESULT = #TRUE
  display ok new_script2 generic save exists

General example of using this file system for saving variables.  Note duplicates will NOT be registered again.

Code: [Select]
gosub TM_NGFS_InitializeScript new_script ; since "generic" is not included, this save data set will be specific to the character/shard
set !test 25
set !this 35
set !variable 45
set %newvar another_value
; Note you can include multiple variables on a single line assuming they are the same namespace
gosub TM_NGFS_RegisterVariables local std test this variable ; local:std namespace
; Or you can just save them individually
gosub TM_NGFS_RegisterVariables local std test ; from local:std !test
gosub TM_NGFS_RegisterVariables local std this ; from local:std !this
gosub TM_NGFS_RegisterVariables local std variable ; from local:std !variable
gosub TM_NGFS_RegisterVariables std std newvar  ; denotes a %var
gosub TM_NGFS_SaveVariables

Storing an array of information generically.  Any script calling for "new_script2" will attempt to load this information

Code: [Select]
gosub TM_NGFS_InitializeScript new_script2 generic ; make a generic copy
for !i 0 100
{
  set !test . !i !i
  gosub TM_NGFS_RegisterVariables local std test . !i
}
gosub TM_NGFS_SaveVariables

Notice all you have to do in order to load a variable set, you just have to initialize/load.  Since in order to "register" a variable, you need to include the namespace type and namespace name, all data in all namespaces will be restored.  With this filesystem, you can actually "freeze" your data used in memory when you save.

Code: [Select]
gosub TM_NGFS_InitializeScript test_script
gosub TM_NGFS_LoadVariables ; loads all variables registered and associated with "test_script"
« Last Edit: March 29, 2010, 11:33:59 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: My new filesystem - first look
« Reply #26 on: March 29, 2010, 12:05:48 PM »
+1
*giggle* I'm all giddy. 

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: My new filesystem - first look
« Reply #27 on: March 30, 2010, 09:35:37 AM »
+1
So I'm going to make one more little tweak to the base functions.  Right now you are kinda hardwired to having one file system set open per script at a time.  One quick tweak to the call/gosub can allow for you to open multiple sets, like one for script specific and one for a generic set.  Also would allow for copying from one set to another because they'll all be in memory instead of having to ping-pong back and forth between loaded sets.  Also, this will clean up the implementation a bit.

I've tested the speed of this and it's remarkably fast for something implemented in EasyUO.  Where it really shines is when you save.  Instead of having to go out to the DOS prompt for a few saves, it's nearly automatic.

So my next posting of the base functions should be good enough for anyone to play with because I won't be changing them after that point.  I'll be adding to the advanced functions so you can get information like the size of a saved set, formatting of a filesystem, copying, deleting or saving to a file for export.
Please read the ScriptUO site RULES
Come play RIFT with me!

Scrripty

  • Guest
Re: My new filesystem - first look
« Reply #28 on: April 19, 2010, 07:40:01 PM »
+1
WE WANT FILESYTEM 2 WE WANT FILESYSTEM 2. :)  Just sayin....

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: My new filesystem - first look
« Reply #29 on: April 19, 2010, 07:44:20 PM »
+1
Sorry dood.  Gonna be a little bit.  Powering down R/L stuff to start up with the new R/L stuff.  So busy tizzy at the moment.
Please read the ScriptUO site RULES
Come play RIFT with me!