Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2
You last visited: Today at 18:32

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Python script to read players around

Discussion on Python script to read players around within the Metin2 forum part of the Popular Games category.

Reply
 
Old   #1
 
Reff's Avatar
 
elite*gold: 20
Join Date: Aug 2008
Posts: 74
Received Thanks: 16
Python script to read players around

Hello!
On the GF client.
I'm trying to read if there are players around me with this code:
Code:
import chr,time,thread,chat,threading

start_time = time.time()

def isInstance(vid):
	if chr.HasInstance(vid):
		return True
	return False

def isSelf(vid):
	if chr.GetNameByVID(vid) == chr.GetName():
		return True
	return False

def isPlayer(vid):
	if isInstance(vid):
		if chr.GetInstanceType(vid) == chr.INSTANCE_TYPE_PLAYER:
			return True
	return False

def SCAN():
	playerlist = []
	for x in xrange(10000000):
		if isInstance(x) and isPlayer(x) and not isSelf(x) and not x in playerlist:
			playerlist.append(x)
	return playerlist

def f1():
	PLRS = SCAN()
	chat.AppendChat(3, "Scan finished. {} players found.".format(len(PLRS)))
	chat.AppendChat(2, "Took {}.".format(time.time()-begin))

t1 = threading.Thread(name='SCAN', target=f1)
t1.start()
t1.join()
But for some reason it won't run?
I don't know why. And do you think this is the best method to do it? I couldn't find any functions to list players around me so I'm scanning for every possible VID number.

If anyone can give me some light Thank you
Reff is offline  
Thanks
1 User
Old 08/03/2018, 17:50   #2

 
M7TRA's Avatar
 
elite*gold: 0
The Black Market: 240/1/0
Join Date: Aug 2011
Posts: 1,094
Received Thanks: 209
Maybe gamforge patched the threading module out with the update.
And i think you import threading wrong. I remember its something like
PHP Code:
from threading import Thread 
You import both threading and thread but they are 2 different modules.
M7TRA is offline  
Old 08/03/2018, 17:56   #3
 
Reff's Avatar
 
elite*gold: 20
Join Date: Aug 2008
Posts: 74
Received Thanks: 16
Quote:
Originally Posted by M7TRA View Post
Maybe gamforge patched the threading module out with the update.
And i think you import threading wrong. I remember its something like
PHP Code:
from threading import Thread 
You import both threading and thread but they are 2 different modules.
I tried importing it both ways. It was indeed working yesterday before patch, now I just can't use it. It seems like when I do import threading it's like threading doesn't exist.

And using this:
Code:
thread.start_new_thread(f1,())
Isn't instantaneous, and sometimes it does not even run too.
Reff is offline  
Old 08/03/2018, 17:58   #4

 
M7TRA's Avatar
 
elite*gold: 0
The Black Market: 240/1/0
Join Date: Aug 2011
Posts: 1,094
Received Thanks: 209
OK, it seems like its patched then..
M7TRA is offline  
Old 08/03/2018, 18:03   #5
 
Reff's Avatar
 
elite*gold: 20
Join Date: Aug 2008
Posts: 74
Received Thanks: 16
Quote:
Originally Posted by M7TRA View Post
OK, it seems like its patched then..
-> thread.start_new_thread(f1,())
This works though for basic tasks, just my code for some reason makes it slow. I don't have much experience with python.

Does anyone know any alternatives? Ways to find players around me within the script.
Reff is offline  
Old 08/03/2018, 18:05   #6

 
M7TRA's Avatar
 
elite*gold: 0
The Black Market: 240/1/0
Join Date: Aug 2011
Posts: 1,094
Received Thanks: 209
Quote:
Originally Posted by nunuh22 View Post
-> thread.start_new_thread(f1,())
This works though for basic tasks, just my code for some reason makes it slow. I don't have much experience with python.

Does anyone know any alternatives? Ways to find players around me within the script.
strange i dont know dude..
M7TRA is offline  
Old 08/07/2018, 13:33   #7
 
Reff's Avatar
 
elite*gold: 20
Join Date: Aug 2008
Posts: 74
Received Thanks: 16
I fixed the threading use by adding the compiled threading.pyc back to metin2 lib folder.
Still, my method of reading players around me is too slow. If anyone's got a better way and they're willing to share?
I'm trying to do this through python only but I'll take any suggestion.
Reff is offline  
Reply


Similar Threads Similar Threads
~+~+~[ALL-AROUND-SHOP]Runescape Gold&Stuff&More![ALL-AROUND-SHOP]~+~+~
05/04/2012 - Runescape Trading - 46 Replies
Good Day ! Herzlich Willkommen in meinem Runescape-Allaround-Shop ! Schaut euch um und seit begeistert, kauft euch Reich und habt mehr Spaß :D ! http://img857.imageshack.us/img857/4157/platz2.pn g Bezahlungsmöglichkeiten: Überweisung (5% RABATT!!!)
~+~+~[ALL-AROUND-SHOP]Runescape Gold&Stuff&More![ALL-AROUND-SHOP]~+~+~
04/11/2012 - Runescape Trading - 0 Replies
Herzlich Willkommen in meinem Runescape-Allaround-Shop ! Schaut euch um und seit begeistert, kauft euch Reich und habt mehr Spaß :D ! http://img857.imageshack.us/img857/4157/platz2.pn g Bezahlungsmöglichkeiten: http://www.paysafecard.com/fileadmin/templates/im ages/paysafecard-logo.gif



All times are GMT +1. The time now is 18:34.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.