Jump to content

Recommended Posts

Hi guys I'm in the middle of coding my first login window. I have one last thing to do and I could it with socket ble ble but I guess it's kinda lame.

So can someone show me any examples of how can I get the state of the channel and depending on either it's online or offline change the buttons ? (green/red)

  • Premium

Use a script in php for check channel status.

 

Then send a request with urllib

check = urllib.urlopen("http://webpageadress/check_server.php?status=").read()

if check == 1:
  youserverON
else
  youserverOFF

Should work.

  • Premium

Well, you can use the ServerStateChecker. You can find it in an original intrologin.py, but I will try to show you how it works.

Firstly, you need to create a new ServerStateChecker and give the current python module to this, which means it will call its functions from the current python script (eg. yourNewIntrologin.py).

ServerStateChecker.Create(self)

You must write it before you wants to do anything with the ServerStateChecker. Do it eg in the Open(self) function, or what you call first when you open the login window.
 
After that write this:

ServerStateChecker.Initialize();
ServerStateChecker.AddChannel(id, ip, udp_port)
ServerStateChecker.Request()

Then create a new function in the same class named NotifyChannelState(self, channelID, state)
The ServerStateChecker will trigger this function, and you will get the state of the channel. Then you could do what you want with it.

And last but not least, add this to the OnUpdate function:

ServerStateChecker.Update()

I hope it was understandable and helpful. ;)

  • Love 1

The one and only UI programming guideline

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.