GabrielAgrela / OSROKBOT

32 stars 11 forks source link

lyceum #11

Closed JefIra24 closed 2 weeks ago

JefIra24 commented 9 months ago

First of all, let me open the question again where is my mistake here.. when trying to do lycuem.. here is my screenshot.. thanks in advance ![Uploading 1111.png…]() ![Uploading Untitled.png…]()

GabrielAgrela commented 9 months ago

I can't see the images you uploaded. But, if you aren't already, try using the bot in 1280*720.

JefIra24 commented 9 months ago

ukuran i have done in size 1280*720

I found the following problem again...

He didn't stop farming... but returned to the city

GabrielAgrela commented 9 months ago

When you run lyceum, it goes farming?

GabrielAgrela commented 9 months ago

and btw, delete the picture that shows your openai api key.

JefIra24 commented 9 months ago

When you run lyceum, it goes farming?

no... that means when I tried the lyceum it couldn't... I tried the agriculture section... and an error occurred.. Unfortunately I can't see the video record.. here's the picture

eror bertani

The bot doesn't press gather... instead it goes back into town

The following is an error in the VS code Untitled

JefIra24 commented 9 months ago

and btw, delete the picture that shows your openai api key.

OK, I'll delete it... but what's my problem with the Lycuem bot?

GabrielAgrela commented 9 months ago

Ok let's start with the problem in gathering. I just tried on my side and works fine, might be related with the animations, so let's try making the bot a bit slower.

On the UI.py file, where it says class UI(QtWidgets.QWidget): def __init__(self, window_title, delay=0): make it so that delay=1.

Then let me know if that fixed the issue on the gathering.

GabrielAgrela commented 9 months ago

And your images are still showing the openai API key, you should delete the images so no one steals it.

GabrielAgrela commented 9 months ago

Regarding the Lyceum, copy and paste the error here.

JefIra24 commented 9 months ago

Regarding the Lyceum, copy and paste the error here. eror bertani

I have done it but still not working..

I got the recording...please take a look

https://clipchamp.com/watch/ajPzFebDm6m

I can't reduce the size

JefIra24 commented 9 months ago

Regarding the Lyceum, copy and paste the error here.

The following error occurred for Lyceum

PS D:\OSROKBOT-master> & C:/Users/Jefri/AppData/Local/Microsoft/WindowsApps/python3.11.exe d:/OSROKBOT-master/Classes/UI.py Your UI Instance C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py:525: UserWarning: The parameter 'token_pattern' will not be used since 'tokenizer' is not None' warnings.warn( Exception in thread Thread-2 (run_single_machine): Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64qbz5n2kfra8p0\Lib\threading.py", line 1045, in _bootstrap_inner self.run() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64qbz5n2kfra8p0\Lib\threading.py", line 982, in run self._target(*self._args, **self._kwargs) File "d:\OSROKBOT-master\Classes\OS_ROKBOT.py", line 29, in run_single_machine if machine.execute(): ^^^^^^^^^^^^^^^^^ File "d:\OSROKBOT-master\Classes\state_machine.py", line 20, in execute result = state.perform() ^^^^^^^^^^^^^^^ File "d:\OSROKBOT-master\Classes\Actions\action.py", line 38, in perform result = self.execute() ^^^^^^^^^^^^^^ File "d:\OSROKBOT-master\Classes\Actions\lyceum_action.py", line 52, in execute closest_question = self.find_most_similar(GlobalVars().Q, questions) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "d:\OSROKBOT-master\Classes\Actions\lyceum_action.py", line 30, in find_most_similar input_vec = tfidf_vectorizer.transform([input_text]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py", line 2163, in transform X = super().transform(raw_documents) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\featureextraction\text.py", line 1434, in transform , X = self._count_vocab(raw_documents, fixed_vocab=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py", line 1276, in _count_vocab for feature in analyze(doc): ^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py", line 110, in _analyze doc = preprocessor(doc) ^^^^^^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py", line 68, in _preprocess doc = doc.lower() ^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'lower'

GabrielAgrela commented 9 months ago

Hmm, for some reason he's not finding the gathering button. Maybe it's something related to the game's resolution.

GabrielAgrela commented 9 months ago

You could start by experimenting with different resolutions, or by screenshoting that button, replacing the media/gatheraction.png

JefIra24 commented 9 months ago

You could start by experimenting with different resolutions, or by screenshoting that button, replacing the media/gatheraction.png

after I did this.. it can run fine..

how to address the lyceum?

GabrielAgrela commented 9 months ago

after I did this.. it can run fine..

Ok, but that's still weird. This bot is developed to mostly work in every resolution as long as the aspect ratio is ~4:3...

how to address the lyceum?

I'm also not being able to replicate that. I pushed some changes, pull them and then screenshot the console, so i can see if the bot is reading the lyceum correctly.

JefIra24 commented 9 months ago

I'm also not being able to replicate that. I pushed some changes, pull them and then screenshot the console, so i can see if the bot is reading the lyceum correctly.

what should I do lyceum

GabrielAgrela commented 9 months ago

Yeah, try doing lyceum after pulling the changes.

JefIra24 commented 9 months ago

OK... I'll try downloading again I'll report back

JefIra24 commented 9 months ago

PS D:\OSROKBOT-master> & C:/Users/Jefri/AppData/Local/Microsoft/WindowsApps/python3.11.exe d:/OSROKBOT-master/Classes/UI.py Your UI Instance C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py:525: UserWarning: The parameter 'token_pattern' will not be used since 'tokenizer' is not None' warnings.warn( Exception in thread Thread-2 (run_single_machine): Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64qbz5n2kfra8p0\Lib\threading.py", line 1045, in _bootstrap_inner self.run() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64qbz5n2kfra8p0\Lib\threading.py", line 982, in run self._target(*self._args, **self._kwargs) File "d:\OSROKBOT-master\Classes\OS_ROKBOT.py", line 29, in run_single_machine if machine.execute(): ^^^^^^^^^^^^^^^^^ File "d:\OSROKBOT-master\Classes\state_machine.py", line 20, in execute result = state.perform() ^^^^^^^^^^^^^^^ File "d:\OSROKBOT-master\Classes\Actions\action.py", line 38, in perform result = self.execute() ^^^^^^^^^^^^^^ File "d:\OSROKBOT-master\Classes\Actions\lyceum_action.py", line 52, in execute closest_question = self.find_most_similar(GlobalVars().Q, questions) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "d:\OSROKBOT-master\Classes\Actions\lyceum_action.py", line 30, in find_most_similar input_vec = tfidf_vectorizer.transform([input_text]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py", line 2163, in transform X = super().transform(raw_documents) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\featureextraction\text.py", line 1434, in transform , X = self._count_vocab(raw_documents, fixed_vocab=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py", line 1276, in _count_vocab for feature in analyze(doc): ^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py", line 110, in _analyze doc = preprocessor(doc) ^^^^^^^^^^^^^^^^^ File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py", line 68, in _preprocess doc = doc.lower() ^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'lower'

I still find errors or bots not working in Lyceum

GabrielAgrela commented 9 months ago

hmm, if you confirm that you pulled the changes, have you installed tesseract? It should also print what he sees in the lyceum (question and the 4 answers)

GabrielAgrela commented 9 months ago

I'm seeing now your print with the tesseract_path var in the .env. I'm pretty sure that's not the correct path or binaries. It should be an .exe. Here's mine for example: TESSERACT_PATH="D:\\eu\\apps\\tess\\tesseract.exe"

JefIra24 commented 9 months ago

can you provide a tutorial to run it..

Looks like I did something wrong to run this bot

GabrielAgrela commented 9 months ago

Once I have a free weekend I will upload a video tutorial. I need to either set a virtual env or a new pc to record the set up from scratch. Anyway, I think you are just missing the tesseract binaries.

JefIra24 commented 9 months ago

Once I have a free weekend I will upload a video tutorial. I need to either set a virtual env or a new pc to record the set up from scratch. Anyway, I think you are just missing the tesseract binaries.

It seems you are right... I installed it on C... not in the Bot Folder... is that so?

I want to ask.. why can't I clone this source code in my VS code terminal?

JefIra24 commented 9 months ago

What is the difference between an RSS farm and a new RSS farm?

can this bot be added to explore the cloud?

GabrielAgrela commented 9 months ago

Rss farm new is something I was still working on. Basically, instead of clicking to check if it's possible to send armies to farm (in other words, if the queue is full), it reads and OCRs the screen to checks how many armies are available in the queue (less clicks, less chance to be banned).

GabrielAgrela commented 9 months ago

It seems you are right... I installed it on C... not in the Bot Folder... is that so?

You can install on C:, no problem. The problem, I think, is that you are not pointing to the .exe.

I want to ask.. why can't I clone this source code in my VS code terminal?

What do you mean? Tesseract?

JefIra24 commented 9 months ago

Rss farm new adalah sesuatu yang masih saya kerjakan. Pada dasarnya, daripada mengeklik untuk memeriksa apakah mungkin mengirim pasukan untuk bertani (dengan kata lain, jika antrean penuh), ia akan membaca dan meng-OCR layar untuk memeriksa berapa banyak tentara yang tersedia dalam antrean (lebih sedikit klik, lebih sedikit peluang untuk bertani) dilarang).

for teasearch it can run normally... Does that mean I have to use RSS Farm for now until the new RSS Farm is finished? Can this bot be added later to the cloud exploring bot that is not yet open?

JefIra24 commented 9 months ago
PS D:\OSROKBOT-master> & C:/Users/Jefri/AppData/Local/Microsoft/WindowsApps/python3.11.exe d:/OSROKBOT-master/Classes/UI.py
Your UI Instance
4

What color is a polar bear's skin?

Pink

White

Orange

Black
C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\sklearn\feature_extraction\text.py:525: UserWarning: The parameter 'token_pattern' will not be used since 'tokenizer' is not None'
  warnings.warn(
Most similar entry 'What color is a polar bears skin?' has a similarity score of: 0.8792 with
Most similar entry 'Black' has a similarity score of: 1.0000 with

D is the closest match
with : 0.8792042693552393

I couldn't find the answer in the database, trying with CGPT

Exception in thread Thread-2 (run_single_machine):
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 1045, in _bootstrap_inner
    self.run()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.11_3.11.1776.0_x64__qbz5n2kfra8p0\Lib\threading.py", line 982, in run     
    self._target(*self._args, **self._kwargs)
  File "d:\OSROKBOT-master\Classes\OS_ROKBOT.py", line 29, in run_single_machine
    if machine.execute():
       ^^^^^^^^^^^^^^^^^
  File "d:\OSROKBOT-master\Classes\state_machine.py", line 20, in execute
    result = state.perform()
             ^^^^^^^^^^^^^^^
  File "d:\OSROKBOT-master\Classes\Actions\action.py", line 38, in perform
    result = self.execute()
             ^^^^^^^^^^^^^^
  File "d:\OSROKBOT-master\Classes\Actions\chatgpt_action.py", line 59, in execute
    chat = openai.Completion.create(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\_utils\_proxy.py", line 22, in __getattr__
    return getattr(self.__get_proxied__(), attr)
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\_utils\_proxy.py", line 43, in __get_proxied__
    return self.__load__()
           ^^^^^^^^^^^^^^^
  File "C:\Users\Jefri\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\openai\lib\_old_api.py", line 33, in __load__
    raise APIRemovedInV1(symbol=self._symbol)
openai.lib._old_api.APIRemovedInV1:

You tried to access openai.Completion, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.

You can run `openai migrate` to automatically upgrade your codebase to use the 1.0.0 interface.

Alternatively, you can pin your installation to the old version, e.g. `pip install openai==0.28`

A detailed migration guide is available here: https://github.com/openai/openai-python/discussions/742

I experienced an error when the lyceum question was not in the database..

what do I have to do? Thank you in advance

GabrielAgrela commented 9 months ago

Openai lib uses new syntax, pull the changes, should be good now

JefIra24 commented 9 months ago

Openai lib uses new syntax, pull the changes, should be good now

I have changed it.. but I can't try it today.. because I have finished the lyceum today.. I will let you know tomorrow

JefIra24 commented 9 months ago
Which of the following French kings was known as the Sun King?
1

Louis XVI

Louis XVII

Louis XV

Louts XIV
Most similar entry 'Which of the following French Kings was known as the Sun King?' has a similarity score of: 1.0000 with
Most similar entry 'Louis XVI' has a similarity score of: 1.0000 with

A is the closest match
with : 0.9999999999999999

Press k to for the next question

I just took the mid lycuem exam.. Do we have to press the letter K on the keyboard before the bot runs?

after I pressed the letter K on the keyboard, the results came out with the code I gave above... does the bot run perfectly or what? I hope you understand my language, because I'm not good at English

GabrielAgrela commented 9 months ago

Midterms and Finals you need to press K for each new question and then he outputs that data and hovers the mouse to the correct answer, since questions are timed and I wanted more control. In these, the bot works more like an assistant, only then you take the final decision. If you want it to do all that automatically you could try implementing it, shouldn't be too hard.

Normal lyceum there's no need to press anything he just auto solves it.

Output looks good to me.

JefIra24 commented 9 months ago

how to apply it automatically? or what is the best? but I couldn't continue the final exam, because I failed the half semester exam

GabrielAgrela commented 9 months ago

You would need to code it.

JefIra24 commented 9 months ago

I'm not an expert at coding it yet... When I tried farming, why did he only choose corn and wood farming, why couldn't he farm corn, wood, then stone, then gold.. and when you try to click on the gold farm at level 6, when you can't find it, the bot just stays silent and doesn't look for gold at the existing level.

GabrielAgrela commented 9 months ago

That functionality would be a good opportunity to develop your skills hehe. Anyways, you can always check the action_sets.py to see each state of the state machine you are running.

In the case of the farm rss (or farm rss new), he will randomly choose what to farm based on what's on the Helpers.getRandomRss() (which i have it at returning only corn or log, but you can add goldicon and stoneicon). I didn't code it so it levels down the search if no RSS node was found because I always put the search at the lowest level.

JefIra24 commented 9 months ago

This means I have to add pictures of gold and stones so that I can farm when I try rss_farm new (do I have to add code or change the existing code?)

GabrielAgrela commented 9 months ago

If you check the media folder, you will see that there is already goldicon.png and stoneicon.png. You only need to change return lambda: random.choice(["cornicon","logicon"]) to return lambda: random.choice(["cornicon","logicon","goldicon","stoneicon"]) in the helpers.py file.

JefIra24 commented 9 months ago

OK, I'll try to change it, thanks in advance.. but the problem occurs again, when level 6 farming is not found, can it change itself to level 5 farming... so the bot doesn't just stay still, the bot will continue running when we leave it

GabrielAgrela commented 9 months ago

From what I remember, when he doesn't find a lvl 6 node, he will just try finding the level 6 node again and again isn't it?

I haven't coded the logic of downgrading. I just kept it at a minimum level since it doesn't make a difference to me, as long as it's running.

JefIra24 commented 9 months ago

That's right, he continuously searches for nodes at level 6, but the troops just keep quiet, it's better if he searches for nodes at a lower level such as at level 5 nodes... isn't that better?

GabrielAgrela commented 9 months ago

Yes

JefIra24 commented 9 months ago

Will you try to make that change later?

JefIra24 commented 9 months ago

hy.. I found in the source code there are scout_explore, farm_gems, and train_trops but it doesn't appear in the UI...

I have tried it by adding it in the UI like this self.action_set_names = ["scout_explore","farm_gems","farm_rss_new","farm_rss","farm_food","farm_wood",,"farm_stone","farm_gold", "farm_barb" , "farm_barb_all", "lyceum", "lyceumMid"]

but when I try it, it doesn't work... can you tell me so that it can run normally as expected?

JefIra24 commented 9 months ago

Can you give me the source code so that this can be run

self.action_set_names = ["scout_explore","farm_gems","farm_rss_new","farm_rss","farm_food","farm_wood",,"farm_stone","farm_gold", "farm_barb" , "farm_barb_all", "lyceum", "lyceumMid"]

GabrielAgrela commented 9 months ago

You have 2 comas in a row

JefIra24 commented 9 months ago

You have 2 comas in a row

I have changed the 2 commas My current problem is that when I run scout explore, the farm gem in UI.py bot doesn't react to the game... thank you

GabrielAgrela commented 9 months ago

farm gem doesn't find the gems 80% of the time, its mostly a hack, thats why it's not mentioned on the readme, that was an experiment.

I couldn't continue development of the scout explore as I cleared all the fog before refining it more.

GabrielAgrela commented 9 months ago

But scout explore should work, if not, you might have to screenshot your own images required for that state machine.