Author Topic: TrailMyx's Advanced File System  (Read 38831 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 Advanced File System
« Reply #15 on: April 14, 2009, 08:04:40 AM »
0
I think this can be very useful in order to change scripts. You can save variables like time and skill gaining in the files in order to know if your code changing has improve the timmings or hasn't.

 I will try it later on. Thanks.

If you do it correctly, you can setup your memory just as you left it, including arrays and multiple namespaces.  These subs are probably some of the most useful ones I've ever written and do show up in just about every public script I've released.  Hope you enjoy them.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline Khameleon

  • Script Tester - Team Leader
  • Elite
  • *
  • *
  • Posts: 2574
  • Activity:
    0%
  • Reputation Power: 30
  • Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!Khameleon is a rising star!
  • Gender: Male
  • Respect: +238
  • Referrals: 0
    • View Profile
Re: TrailMyx's Advanced File System
« Reply #16 on: April 14, 2009, 03:18:13 PM »
0
the best part about TM's AFS is if you formate your computer, IF you saved your setup files you won't have to run the Config again, it will just load your setup as if you never skipped a beat.

Offline VicVega

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: TrailMyx's Advanced File System
« Reply #17 on: April 15, 2009, 08:29:35 AM »
0
I've already try to get this running but get stuck on the example (after call interface line).

It doesn't create any file on c:\bigtest.txt
What am I doing wrong?

Code: [Select]
;============================================================
; Script Name: TrailMyx's Advanced File System Handling Subs
; Author: TrailMyx
; Version: 1.3
; Shard OSI / FS: Any
; Revision Date: 10/20/2007
; Purpose:
;     Simplify the saving of variables to a file.  Also to speed up the process
;   by minimizing the number times calls to the shell are issued.  A maximum of
;   2000 bytes are assigned to each shell call, with an unlimited amount of calls
;   possible.  It's easy to store 1000's of variables in a relatively short period
;   of time.
;
;   This set of functions will also handle any namespace (local, global, immediate)!
;   Also, this file is ready to be 'called'.
;
; Limitations:
;     You cannot store spaces to a file due to the way DOS handles the command line.
;   So if a space is found, it will be converted to an underscore '_'
;
; Functions:
;   TM_FileSystem_CreateFileHandle
;      -- ex. gosub TM_FileSystem_CreateFileHandle handle1
;   TM_FileSystem_SaveVariable
;      -- ex. gosub TM_FileSystem_SaveVariable local std handle1 testval ; note not to include the '%' or '!' for variable
;   TM_FileSystem_SaveFile
;      -- ex. gosub TM_FileSystem_SaveFile handle1 c:\bigtest.txt
;   TM_FileSystem_LoadFile
;      -- ex. gosub TM_FileSystem_LoadFile c:\bigtest.txt
;   TM_FileSystem_SaveArray
;      -- ex. gosub TM_FileSystem_SaveArray local ns1 handle ns1_test 10 20
;
; Support functions:
;   TM_ReadVariables
;   AddUnderscore
;   AddSpace
;
;============================================================
; Revision History:
;   v1.0 - Initial release.
;   v1.1 - 5/16/2007 - Added support for array saving TM_SaveArray.
;   v1.2 - Much faster load times.
;   v1.3 - Much faster save preparation, fixed a bug in load pointer, added call handler
;=================================================================
;------------------------  Call interface  -----------------------
;=================================================================

set #LPC 10000
for %i 0 1000
  set %test . %i %i * 100

gosub TM_FileSystem_CreateFileHandle NULL handle1 ; clear handle named 'handle1'
for %i 0 1000
{
  gosub TM_FileSystem_SaveVariable NULL local std handle1 test , %i ; store %test0, %test1, %test2, etc.
}

gosub TM_FileSystem_SaveFile NULL handle1 c:\bigtest.txt ; save the file
halt

set !TM_FunctionCalled #FALSE
if %0 = 1
  gosub %1
if %0 = 2
  gosub %1 %2
if %0 = 3
  gosub %1 %2 %3
if %0 = 4
  gosub %1 %2 %3 %4
if %0 = 5
  gosub %1 %2 %3 %4 %5
if %0 = 6
  gosub %1 %2 %3 %4 %5 %6
if %0 = 7
  gosub %1 %2 %3 %4 %5 %6 %7
if %0 = 8
  gosub %1 %2 %3 %4 %5 %6 %7 %8
if %0 = 9
  gosub %1 %2 %3 %4 %5 %6 %7 %8 %9
if %0 = 10
  gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10
if %0 = 11
  gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11
if %0 > 11
{
  display ok Too many arguments for "call", edit file.
  stop
}

if !TM_FunctionCalled = #TRUE
  exit
if %0 = N/A
  display ok You may not run this script directly.
else
  display ok Function " , %1 , " not found.
stop
;================================ File System ==================================
;-------------------------------------------------------------------------------
; %1 - Name of file handle name to create
sub TM_FileSystem_CreateFileHandle
  namespace push
  namespace local TM_FileSystem
  set !ptr %1 , _ptr ; {userhandle}_ptr
  set ! . !ptr 0 ; !{userhandle}_ptr (actual pointer)
  set !handle ! . !ptr
  set !handle %1 , !handle
  set ! . !handle ; assume new variable
  namespace pop
  set !TM_Function_found #TRUE
return
;-------------------------------------------------------------------------------
; %1 = namespace location (local, global)
; %2 = namespace name
; %3 = file handle name
; %4 = variable name
sub TM_FileSystem_SaveVariable
  namespace push
  namespace local TM_FileSystem
  set !ns_loc %1
  set !ns_name %2
  set !handle %3
  set !var %4
  set !sep 
  set !temp_LPC #LPC
  set #LPC 1000
  if !handle = handle
    set !handle __ , handle
  set !ptr !handle , _ptr ; {userhandle}_ptr
  set !handle_copy !handle
  if ! . !ptr = N/A
  {
    set ! . !ptr 0 ; !{userhandle}_ptr (actual pointer)
    set !handle_copy ! . !ptr
    set !handle_copy !handle , !handle_copy
    set ! . !handle_copy ; assume new variable
  }
  set !handle_copy ! . !ptr
  set !handle_copy !handle , !handle_copy
  if !ns_loc = local && !ns_name = std
    set !value % . !var
  else
  {
    namespace copy !var from !ns_loc !ns_name
    set !value ! . !var
  }
  gosub AddUnderscore !value ; must not have spaces in stored variables!!!
  set ! . !handle_copy ! . !handle_copy , !ns_loc , !sep , !ns_name , !sep , !var , !sep , #RESULT , !sep
  str len ! . !handle_copy
  if #STRRES > 2000
  {
    set !len #STRRES
    str left ! . !handle_copy 2000
    set !temp #STRRES
    str del ! . !handle_copy 1 2000
    set ! . !handle_copy !temp
    set ! . !ptr ! . !ptr + 1
    set !handle_copy ! . !ptr
    set !handle_copy !handle , !handle_copy
    set ! . !handle_copy #STRRES
  }
  set !value
  set !temp
  set #LPC !temp_LPC
  namespace pop
  set !TM_Function_found #TRUE
return
;-------------------------------------------------------------------------------
; %1 = namespace location (local, global)
; %2 = namespace name
; %3 = file handle name
; %4 = array name
; %5 = starting index
; %6 = ending index
sub TM_FileSystem_SaveArray
  namespace push
  namespace local TM_FileSystem
  set !temp_LPC #LPC
  set #LPC 10000
  set !ns_loc %1
  set !ns_name %2
  set !handle %3
  set !var %4
  set !start_index %5
  set !end_index %6
  set !sep 
  if !handle = handle
    set !handle __ , handle
  set !ptr !handle , _ptr ; {userhandle}_ptr
  set !handle_copy !handle
  if ! . !ptr = N/A
  {
    set ! . !ptr 0 ; !{userhandle}_ptr (actual pointer)
    set !handle_copy ! . !ptr
    set !handle_copy !handle , !handle_copy
    set ! . !handle_copy ; assume new variable
  }
  set !handle_copy ! . !ptr
  set !handle_copy !handle , !handle_copy
  for !i !start_index !end_index
  {
    if !ns_loc = local && !ns_name = std
    {
      set !newvar !var , !i
      set !value % . !newvar
    }
    else
    {
      set !newvar !var , !i
      namespace copy !newvar from !ns_loc !ns_name
      set !value ! . !newvar
    }
    gosub AddUnderscore !value ; must not have spaces in stored variables!!!
    set ! . !handle_copy ! . !handle_copy , !ns_loc , !sep , !ns_name , !sep , !newvar , !sep , #RESULT , !sep
    str len ! . !handle_copy
    if #STRRES > 2000
    {
      set !len #STRRES
      str left ! . !handle_copy 2000
      set !temp #STRRES
      str del ! . !handle_copy 1 2000
      set ! . !handle_copy !temp
      set ! . !ptr ! . !ptr + 1
      set !handle_copy ! . !ptr
      set !handle_copy !handle , !handle_copy
      set ! . !handle_copy #STRRES
    }
  }
  set !value
  set !temp
  set #LPC !temp_LPC
  namespace pop
  set !TM_Function_found #TRUE
return
;-------------------------------------------------------------------------------
; %1 = file handle name
; %2 = file name
sub TM_FileSystem_SaveFile
  namespace push
  namespace local TM_FileSystem
  set !temp_LPC #LPC
  set #LPC 10000
  set !LINE_LENGTH 2000 ; near DOS maximum
  set !handle %1
  set !filename %2
  if !handle = handle
    set !handle __ , handle
  set !ptr !handle , _ptr ; {userhandle}_ptr
  for !i 0 ! . !ptr
  {
    set !handle_copy !handle , !i
    set !str ! . !handle_copy
    if !i = 0
      execute cmd.exe /c echo set , #spc , ! , fileout , !i ,  #spc , !str > !filename
    else
      execute cmd.exe /c echo set , #spc , ! , fileout , !i , #spc , !str >> !filename
  }
  set #LPC !temp_LPC
  namespace pop
  set !TM_Function_found #TRUE
return
;-------------------------------------------------------------------------------
; %1 - file line variable
sub TM_ReadVariables
  set !temp %1
  set !fileoutindex 0
  set !fileout !fileout0
  TM_ReadVariables_loop1:
    gosub ReadItem ns_loc
    if #RESULT = #TRUE
      goto TM_ReadVariables_skip1
    gosub ReadItem ns_name
    if #RESULT = #TRUE
      goto TM_ReadVariables_skip1
    gosub ReadItem var
    if #RESULT = #TRUE
      goto TM_ReadVariables_skip1
    gosub ReadItem value
    if #RESULT = #TRUE
      goto TM_ReadVariables_skip1

    if !ns_loc in local_LOCAL && !ns_name in std_STD
      set % . !var !value
    else
    {
      set ! . !var !value
      namespace copy !var to !ns_loc !ns_name
    }
    goto TM_ReadVariables_loop1

  TM_ReadVariables_skip1:
return
;-------------------------------------------------------------------------------
; Passes %fileout(n) as local, #RESULT
sub ReadItem
  str pos !fileout 
  if #STRRES = 0
  {
    set !fileoutindex !fileoutindex + 1
    if !fileout . !fileoutindex <> N/A
    {
      set !fileout !fileout , !fileout . !fileoutindex
      str pos !fileout 
    }
    else
    {
      return #TRUE
    }
  }
  set !len #STRRES - 1
  str left !fileout !len
  set ! . %1 #STRRES
  set !len !len + 1
  str del !fileout 1 !len
  set !fileout #STRRES
return #FALSE
;-------------------------------------------------------------------------------
; %2 - file name
sub TM_FileSystem_LoadFile
  namespace push
  namespace local TM_FileSystem
  set !lpc #LPC
  set #LPC 10000
  set !filename %1

  for !i 0 1000
    set !fileout . !i N/A

  call !filename
  if !fileout0 = N/A
  {
    set #LPC !lpc
    namespace pop
    set !TM_Function_found #TRUE
    return #TRUE ; error
  }

  set !index 0
  gosub TM_ReadVariables ; assumes namespace TM_FileSystem

  set #LPC !lpc
  namespace pop
  set !TM_Function_found #TRUE
return #FALSE
;-------------------------------------------------------------------------------
; %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
;-------------------------------------------------------------------------------
; %1 - string to mung
sub AddSpace
  namespace push
  namespace local AS
  set !tempstring %1
  AddSpace_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 AddSpace_loop1
    }
  set #RESULT !tempstring
  namespace pop
return #RESULT

To learn, read.
To know, write.
To master, teach.

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 Advanced File System
« Reply #18 on: April 15, 2009, 09:10:38 AM »
0
Are you running Vista?
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVega

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: TrailMyx's Advanced File System
« Reply #19 on: April 15, 2009, 09:28:29 AM »
0
I am running Windows Vista yes.

The only problem I have had on Windows Vista it's with exevent popup, till now ...  :'(
To learn, read.
To know, write.
To master, teach.

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 Advanced File System
« Reply #20 on: April 15, 2009, 09:33:18 AM »
0
OT:  I don't have any problem with the exevent popup in Vista.  ;)  (though I'm using Windows 7)  The exevent pop always follows the server type.

OnT:
That example was really targeted to use WinXP.  You might trying changing this:

Code: [Select]
gosub TM_FileSystem_SaveFile NULL handle1 c:\bigtest.txt ; save the file
halt

to this:

Code: [Select]
set %filename #CURPATH , bigtest.txt
gosub TM_FileSystem_SaveFile NULL handle1 %filename  ; save the file
halt

This should save the file to the same directory as your EUO.exe file.

(untested of course, but I use it constantly)
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVega

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: TrailMyx's Advanced File System
« Reply #21 on: April 15, 2009, 09:47:46 AM »
0
Creates a file on that directory ( C:\Users\admin\Desktop\varios\juegos\UO\euo\ ) called handle1

In the file there is only one line: set !fileout0

And it's not a .txt file
To learn, read.
To know, write.
To master, teach.

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 Advanced File System
« Reply #22 on: April 15, 2009, 09:49:22 AM »
0
Oh, also get rid of the NULL.  That example was from when the subs were called only.  Sorry, I forgot to mention that.  I need to update the examples.... :)
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVega

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: TrailMyx's Advanced File System
« Reply #23 on: April 15, 2009, 10:05:13 AM »
0
I had to change also the second parameter to 10 in the for bucles.

If the second parameter it's 100 or 1000 it displays this error message:

Quote
c:\windows\system32\cmd.exe The data pased to a system call it's too small

set #LPC 10000
for %i 0 10
  set %test . %i %i * 100

gosub TM_FileSystem_CreateFileHandle handle1 ; clear handle named 'handle1'
for %i 0 10
{
  gosub TM_FileSystem_SaveVariable local std handle1 test , %i ; store %test0, %test1, %test2, etc.
}

set %filename #CURPATH , bigtest.txt
gosub TM_FileSystem_SaveFile handle1 %filename  ; save the file
halt
To learn, read.
To know, write.
To master, teach.

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 Advanced File System
« Reply #24 on: April 15, 2009, 10:22:29 AM »
0
Hmm, it seems to work for me.  Even at 1000.  You might try running EUO as administrator.

Code: [Select]
set !fileout0 localstdtest00localstdtest1100localstdtest2200localstdtest3300localstdtest4400localstdtest5500localstdtest6600localstdtest7700localstdtest8800localstdtest9900localstdtest101000localstdtest111100localstdtest121200localstdtest131300localstdtest141400localstdtest151500localstdtest161600localstdtest171700localstdtest181800localstdtest191900localstdtest202000localstdtest212100localstdtest222200localstdtest232300localstdtest242400localstdtest252500localstdtest262600localstdtest272700localstdtest282800localstdtest292900localstdtest303000localstdtest313100localstdtest323200localstdtest333300localstdtest343400localstdtest353500localstdtest363600localstdtest373700localstdtest383800localstdtest393900localstdtest404000localstdtest414100localstdtest424200localstdtest434300localstdtest444400localstdtest454500localstdtest464600localstdtest474700localstdtest484800localstdtest494900localstdtest505000localstdtest515100localstdtest525200localstdtest535300localstdtest545400localstdtest555500localstdtest565600localstdtest575700localstdtest585800localstdtest595900localstdtest606000localstdtest616100localstdtest626200localstdtest636300localstdtest646400localstdtest656500localstdtest666600localstdtest676700localstdtest686800localstdtest696900localstdtest707000localstdtest717100localstdtest727200localstdtest737300localstdtest747400localstdtest757500localstdtest767600localstdtest777700localstdtest787800localstdtest797900localstdtest808000localstdtest818100localstdtest828200localstdtest838300localstdtest848400localstdtest858500localstdtest868600localstdtest878700localstdtest888800localstdtest898900localstdtest909000localstdtest91910
set !fileout1 0localstdtest929200localstdtest939300localstdtest949400localstdtest959500localstdtest969600localstdtest979700localstdtest989800localstdtest999900localstdtest10010000localstdtest10110100localstdtest10210200localstdtest10310300localstdtest10410400localstdtest10510500localstdtest10610600localstdtest10710700localstdtest10810800localstdtest10910900localstdtest11011000localstdtest11111100localstdtest11211200localstdtest11311300localstdtest11411400localstdtest11511500localstdtest11611600localstdtest11711700localstdtest11811800localstdtest11911900localstdtest12012000localstdtest12112100localstdtest12212200localstdtest12312300localstdtest12412400localstdtest12512500localstdtest12612600localstdtest12712700localstdtest12812800localstdtest12912900localstdtest13013000localstdtest13113100localstdtest13213200localstdtest13313300localstdtest13413400localstdtest13513500localstdtest13613600localstdtest13713700localstdtest13813800localstdtest13913900localstdtest14014000localstdtest14114100localstdtest14214200localstdtest14314300localstdtest14414400localstdtest14514500localstdtest14614600localstdtest14714700localstdtest14814800localstdtest14914900localstdtest15015000localstdtest15115100localstdtest15215200localstdtest15315300localstdtest15415400localstdtest15515500localstdtest15615600localstdtest15715700localstdtest15815800localstdtest15915900localstdtest16016000localstdtest16116100localstdtest16216200localstdtest16316300localstdtest16416400localstdtest16516500localstdtest16616600localstdtest16716700localstdtest16816800localstdtest16916900localstdtest17017000localstdtest17117100localstdtest17217200localstdtest17317300localstdtest17417400localstdtest1751750
...
...
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVega

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: TrailMyx's Advanced File System
« Reply #25 on: April 15, 2009, 01:36:51 PM »
0
Same problem running it as admin, but maybe 10 variables it's enough for me, if the rest of the script it's compatible with that. I really don't know, but I would like to learn how to save variables on files.
To learn, read.
To know, write.
To master, teach.

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 Advanced File System
« Reply #26 on: April 15, 2009, 01:41:13 PM »
0
That's just strange.  But I'm using Win7.

Have I mentioned lately that I really really hate Vista??????

What's odd is that Xclio has used these before (in the Full Auto Fisherman) and didn't have a problem.  He's a big Vista fanboi so he was able to get it to function.
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 Advanced File System
« Reply #27 on: April 15, 2009, 01:58:07 PM »
0
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVega

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: TrailMyx's Advanced File System
« Reply #28 on: April 16, 2009, 01:08:31 AM »
0
It seems that the problem was that the file path was too long, I have tried this code and now works fine:

Code: [Select]
set #LPC 10000
for %i 0 1000
  set %test . %i %i * 100

gosub TM_FileSystem_CreateFileHandle handle1 ; clear handle named 'handle1'
for %i 0 1000
{
  gosub TM_FileSystem_SaveVariable local std handle1 test , %i ; store %test0, %test1, %test2, etc.
}

set %filename c:\bigtest.txt
gosub TM_FileSystem_SaveFile handle1 %filename  ; save the file
halt

Part of the first line in the file on c:\bigtest.txt:

Quote
set !fileout0 localstdtest00localstdtest1100localstdtest2200localstdtest3300localstdtest4400localstdtest5500localstdtest6

Is this good enough or should I try restoring the NULL commands now?
To learn, read.
To know, write.
To master, teach.

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 Advanced File System
« Reply #29 on: April 16, 2009, 09:05:12 AM »
0
Oh, don't put the NULL stuff back.  That was legacy from when these subs were just "call"able.  The problem between "calling" and "gosubing" to a sub is that it shifts your arguments to the left by 1 (or adds 1 to your argument index for each argument).  Since I included the call handler at the top of the subs, I was able to eliminate this dependency and so I just removed the need to have that argument shift.

If you place this section at the top of any set of subs, you may either call them, or gosub to them:

Code: [Select]
set !TM_FunctionCalled #FALSE
if %0 = 1
  gosub %1
if %0 = 2
  gosub %1 %2
if %0 = 3
  gosub %1 %2 %3
if %0 = 4
  gosub %1 %2 %3 %4
if %0 = 5
  gosub %1 %2 %3 %4 %5
if %0 = 6
  gosub %1 %2 %3 %4 %5 %6
if %0 = 7
  gosub %1 %2 %3 %4 %5 %6 %7
if %0 = 8
  gosub %1 %2 %3 %4 %5 %6 %7 %8
if %0 = 9
  gosub %1 %2 %3 %4 %5 %6 %7 %8 %9
if %0 = 10
  gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10
if %0 = 11
  gosub %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11
if %0 > 11
{
  display ok Too many arguments for "call", edit file.
  stop
}

if !TM_FunctionCalled = #TRUE
  exit
if %0 = N/A
  display ok You may not run this script directly.
else
  display ok Function " , %1 , " not found.
stop
« Last Edit: April 16, 2009, 09:07:42 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!