Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - VicVega

Pages: 1 ... 3 4 [5]
61
Script development tools / Re: TrailMyx's Advanced File System
« on: April 15, 2009, 01:36:51 PM »
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.

62
Script development tools / Re: TrailMyx's Advanced File System
« on: April 15, 2009, 10:05:13 AM »
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

63
Script development tools / Re: TrailMyx's Advanced File System
« on: April 15, 2009, 09:47:46 AM »
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

64
Script development tools / Re: TrailMyx's Advanced File System
« on: April 15, 2009, 09:28:29 AM »
I am running Windows Vista yes.

The only problem I have had on Windows Vista it's with exevent popup, till now ...  :'(

65
Script development tools / Re: TrailMyx's Advanced File System
« on: April 15, 2009, 08:29:35 AM »
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


66
Script development tools / Re: TrailMyx's Advanced File System
« on: April 14, 2009, 06:33:02 AM »
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.

67
Script Debug / Re: Buy_List Gump Menu issue
« on: April 13, 2009, 11:19:01 AM »
It's a Sphere Server. It uses Mondains Legacy 5.8.0.1

Sphere server 0.59b I think

68
Script Debug / Re: Buy_List Gump Menu issue
« on: April 13, 2009, 11:00:40 AM »
I think I understand then, but the problem it's that I also use #findID in order to use exevent popup:

Code: [Select]
set %vendor IS
finditem %vendor G_10
if #FINDCNT > 0
exevent Popup #findid
halt

But it doesn't work, nothings happens and I don't know why.

69
Script Debug / Re: Buy_List Gump Menu issue
« on: April 13, 2009, 08:05:25 AM »
Event popup has been bugged for quite some time.  Actually I thought it worked on RunUO-based shards, but has never worked for me on OSI.  Normally when I use event popup, I wait for the particular gump to popup and then manually click into the gump region.  This works for OSI/RunUO/Anything:

Code: [Select]
      exevent popup !bagofsending
      gosub GumpWait normal_gump normal_gump
      set !clickx #CONTPOSX + 30
      set !clicky #CONTPOSY + 28
      click !clickx !clicky dmc

What's this? -> !bagofsending

you don't use the vendor's ID on the exevent popup?

70
Script Debug / Re: Buy_List Gump Menu issue
« on: April 13, 2009, 12:33:48 AM »
I will leave a static number of clicks then.

Any idea why exevent popup doesn't work?

The #findID of the vendor I use in order to try to use the exevent popup it's fine but nothing happens.

71
Script Debug / Buy_List Gump Menu issue
« on: April 12, 2009, 06:19:44 AM »
The shard where I play uses the mondains legacy game.

I have made an script in order to sell my fishes more quickly. The script works fine and serves it's purpose. But I would like to improve this part:

 
Code: [Select]
set %amount 30
click 240 80 x %amount ; It clicks 30 times on the first element of the menu list

click 315 420 ; accept button
gosub waitForGumpDisappear
finditem %fishType C_ , #backpackID
}

There is a way to know wich fish it's gonna be first in the buy_list menu?

So I could make something like this:


 
Code: [Select]
set %amount #findStack
click 240 80 x %amount ; It clicks 30 times on the first element of the menu list

click 315 420 ; accept button
gosub waitForGumpDisappear
finditem %fishType C_ , #backpackID
}

Use #findstack to determine the number of clicks that have to be made.

Another thing I would like to improve it's the method to open the buy_list gump, I've tried the exevent popup without success with something like this:

Code: [Select]
finditem %vendor G_10
if #FINDCNT > 0
exevent Popup #findid 1
halt

The complete working script that I'm currently using:


Code: [Select]
;==================================
; Script Name: SellSub
; Author: VicVega
; Version: 0.1
; Client Tested with: 5. Something
; EUO version tested with: 1.5 (Version 148)
; Shard: Epsilon UO
; Revision Date: 12-04-09
; Public Release:
; PSL Release:
; Purpose: Sells all fish in your Backpack to an NPC
;==================================
set %fishType GQD_TLW_VLW_DMW_LGW_NGW_GMW_FQD_OGW_WLW_
              +YLW_DQD_SLW_ULW_FMW_EMW_XLW_RLW_EQD
set %vendor Conway

sell:
;open vendor's popup menu and click sell option
finditem %fishType C_ , #backpackID
while #findkind <> -1
{

msg %vendor sell $

gosub waitForgump


set %amount 30
click 240 80 x %amount

click 315 420 ; accept button
gosub waitForGumpDisappear
finditem %fishType C_ , #backpackID
}

exit

sub waitForGump
set %timeout #scnt + 5
loop:
If #contname <> bill_gump
{
 if #scnt > %timeout
    return
 else
   goto loop
}
return

sub waitForGumpDisappear
set %timeout #scnt + 5
loop2:
If #contname = bill_gump
{
 if #scnt > %timeout
    return
 else
   goto loop2
}
return

Also later on I'm planning on add another sub in order to know how muck money it's gained in the complete transaction.

Pages: 1 ... 3 4 [5]