Page 1 of 1
fix a script
Posted: 22 May 2022, 21:22
by way1000
the script works but doesn't support many entries (rows) on "edited item stats.txt"
i need it to work for more than one row on "edited item stats.txt"
it only supports 1 row, i need it for 300 rows
.
Code: Select all
Loop, Read, edited item stats.txt
{
Array := StrSplit(A_LoopReadLine, "`t")
Title := Array[1]
Itemtype := Array[2]
Multiplier := Array[6]
GenFile := "item info stat " A_Index ".txt"
Loop, Read, %itemtype%.txt, %GenFile%
{
RegExMatch(A_LoopReadLine, "[a-zA-Z]+", Type)
RegExMatch(A_LoopReadLine, "\d+\.\d+", Value)
FileAppend, % ((A_Index > 1) ? "`n" : "") Title " " Type "`t" Round(Value*Multiplier)
}
}
Re: fix a script
Posted: 23 May 2022, 04:03
by mikeyww
Four files were created here.
Re: fix a script
Posted: 23 May 2022, 08:25
by way1000
not four files here
can you make it work so it adds up in one file as "item info stat.txt"
Re: fix a script
Posted: 23 May 2022, 08:38
by mikeyww
Are you running the same script that you posted? Do the other files exist in the expected place? Is the script finding those files? What is your working directory, and how do you know? Are there different versions of the text files in the actual working directory? The first question to address is why we get different results. What are your thoughts there? If needed, you can add some lines that will display the values of your variables within the script. That can help.
Re: fix a script
Posted: 23 May 2022, 11:08
by way1000
- Screenshot_16.png (108.89 KiB) Viewed 892 times
.
these are all then files i have
Re: fix a script
Posted: 23 May 2022, 11:12
by way1000
it has to change either way i don't need many files as a result i only need 1 file
Re: fix a script Topic is solved
Posted: 23 May 2022, 11:48
by Xtra
way1000 wrote: ↑23 May 2022, 11:12
it has to change either way i don't need many files as a result i only need 1 file
Change
GenFile := "item info stat " A_Index ".txt"
to output as one file:
GenFile := "item info stat.txt"
Re: fix a script
Posted: 23 May 2022, 12:36
by way1000
thanks now it works but there's another problem
.
the text is not formatted well
.
here is a messed up file and a wanted result
.
- Screenshot_17.png (95.81 KiB) Viewed 874 times
Re: fix a script
Posted: 23 May 2022, 17:10
by way1000
help plz
hehehe...LOL!
i need a genius to fix it!
Re: fix a script
Posted: 23 May 2022, 17:38
by Xtra
You have bad file with bad formatting being used.
Figure out why its like that and you should have the result you want.
Re: fix a script
Posted: 23 May 2022, 19:04
by way1000
Xtra wrote: ↑23 May 2022, 17:38
You have bad file with bad formatting being used.
Figure out why its like that and you should have the result you want.
it because after the previous data lines there has to be a new line. new line is "/n" or something every time there is an end in the next one should be a line break
Re: fix a script
Posted: 23 May 2022, 22:41
by way1000
help plz
Re: fix a script
Posted: 24 May 2022, 03:20
by Xtra
Use a var to know which is the 1st line.
Code: Select all
lineNum := 0
Loop, Read, edited item stats.txt
{
Array := StrSplit(A_LoopReadLine, "`t")
Title := Array[1]
Itemtype := Array[2]
Multiplier := Array[6]
GenFile := "item info stat.txt"
Loop, Read, %itemtype%.txt, %GenFile%
{
RegExMatch(A_LoopReadLine, "[a-zA-Z]+", Type)
RegExMatch(A_LoopReadLine, "\d+\.\d+", Value)
FileAppend, % (++lineNum = 1 ? "" : "`n") Title " " Type "`t" Round(Value*Multiplier)
}
}
Re: fix a script
Posted: 24 May 2022, 08:32
by way1000
thank you so much!
it works