Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScanJournal update #121

Open
Nefariis opened this issue Nov 27, 2020 · 0 comments
Open

ScanJournal update #121

Nefariis opened this issue Nov 27, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@Nefariis
Copy link

Is your feature request related to a problem? Please describe.
I think there needs to be an update to ScanJournal - if you call it on repeat a 100 times there is maybe an 80-85% accuracy rate.

for example -

[System] [FFBB00]You take [98FB98]1[FFBB00] clumps of [98FB98]Silt[FFBB00] from the soil.
[System] [FFBB00]You take [98FB98]1[FFBB00] clumps of [98FB98]Loam[FFBB00] from the soil.
N/A
[System] [FFBB00]You take [98FB98]1[FFBB00] clumps of [98FB98]Loam[FFBB00] from the soil.
N/A
[System] [FFBB00]You take [98FB98]1[FFBB00] clumps of [98FB98]Clay[FFBB00] from the soil.
[System] [FFBB00]You take [98FB98]1[FFBB00] clumps of [98FB98]Clay[FFBB00] from the soil

Describe the solution you'd like

I would like to see a solution that can be implemented like this -

StartScanning() 
WhateverCommandHere()
print(RetrieveJournalScan()) # contains an array of everything from StartScanning() to RetrieveJournalScan()

and or, to expand on it...

StartScanning() 
WhateverCommandHere()
boolean = JournalScanMatch({"match str1, match str2, match str3"}) - returns true if any of the strings are found

I think what this is going to take is creating a separate thread and then using thread.join() to make sure the JournalScanner() is finished before the main thread accesses it - I foresee needing a sleep(500) or sleep(1000) in the scanner thread as well to ensure that the messages are properly picked up.

Currently how I am solving this problem is this -

function JournalScanner(startT, endT)
    arry = {}
    for i = startT, endT, .5 do
         table.insert(arry, ScanJournal(i))
    end
    return arry
end

and then it's called with something like -

start = TIME
SomeCommand()
sleep(500)
SCANJOURNAL = JournalScanner(start, TIME)

or

function JournalScanner(startT, endT, search)
    for i = startT, endT, .5 do
         ScanJournal(i)
         for str in search do
         	if string.match(SCANJOURNALMESSAGE, str) then 
                return true
         	end
         end
    end
    return false
end

and then

start = TIME
SomeCommand()
sleep(500)
boolean = JournalScannerMatch(start, TIME, {"match str1, match str2, match str3"})

Notice that sleep(500) in there? - that really is what ensures that the command's journal output is properly caught - this is why I believe that a separate thread is necessary as you wouldn't want to freeze the main thread and you still need to call the command that follows the StartScanning().

Broken pseudo code - (I haven't written C# in 10 years, please excuse the cross threading and the accessing variables on different threads)

static void scanner() {
    startTime = TIME
    sleep(500)
    get journalEntries between startTime and NOW
    JOURNAL_ARRAY = array of entries 
}

static void DoAction() {
      TargetDynamic or whatever
}

static void Main(args) {
    thread1 = new Thread(scanner)
    thread1.start()
    DoAction()
    thread1.join()
    print(JOURNAL_ARRAY)
}
@Nefariis Nefariis added the enhancement New feature or request label Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant