So i have been fiddling around with python and league of legends. And i found out you can make notes in game. So i thought about making python code read a line of text from the note i made in game, like "Lux no flash", but it doesn't seems to be able to read it at all, it only works when i do it manually with the exact same code. Here is my code:
import os import time def main(): os.chdir('C:\\Riot Games\\League of Legends\\RADS\\solutions\\lol_game_client_sln\\releases\\0.0.1.237') f=open("MyNotes.txt", "r") if f.mode == 'r': lines=f.readlines() text = lines[4] time.sleep(0.1) if text == 'Lux no flash': print('Done') else: print('Something went wrong') f.close() if __name__== "__main__": main() The output is "something went wrong", but when i do it manually it says "done". I feel like python cant read league code. Maybe you guys know how to do this... This is the .txt file im trying to access:
################################################## 2018-09-13_18-57-33_ ################################################## Lux no flash
Lis what makes your code not work I think.readlines(), the line separator is preserved in the resulting strings, so you need to look for'Lux no flash\n'; 2) lists are zero-indexed, so this line is at position 3, not 4.lower()to compare==certaintly is case-sensitive.