Trade Chat Answer

Due to each server changing random parts of their answer you may need to modify the script to make it work.

from phBot import *
import phBotChat

import re
from time import sleep

def handle_chat(t, player, msg):
	if len(player) == 0:
		m = re.findall(r'(\d+)', msg)
		if m and len(m) >= 2:

			if msg.find('+') != -1 or msg.find(' x ') != -1:
				result = int(m[0]) + int(m[1])
			else:
				result = int(m[0]) * int(m[1])

			sleep(1.0)

			log('Sending result %s' % str(result))
			if msg.find('/answer') != -1:
				phBotChat.All('/answer ' + str(result))
			else:
				phBotChat.All(str(result))
	elif (player.find('JobSecure') != -1 or player.find('BotCheck') != -1) and msg.lower().find('job experience') != -1:
		sleep(1.0)
		phBotChat.Private(player, str(get_character_data()['job_current_exp']))
	elif player == 'RemoLogger' or player == 'Bot' or player == 'BotCheck':
		m = re.findall(r'(\d+)', msg)
		if m:
			if len(m) == 1:

				sleep(1.0)

				log('Sending result %s' % str(m[0]))
				phBotChat.Private(player, str(m[0]))

			elif len(m) >= 2:

				if msg.find('+') != -1 or msg.find(' x ') != -1:
					result = int(m[0]) + int(m[1])
				else:
					result = int(m[0]) * int(m[1])

				sleep(1.0)

				log('Sending result %s' % str(result))
				phBotChat.Private(player, str(result))
		elif msg.lower().find('kervankey') != -1:
			sleep(1.0)
			phBotChat.Private(player, 'Kervankey')

log('[%s] Loaded' % __name__)
5 Likes

Is this plugin answers the question if the question sended by a character by pm?

Depends on the name of the player that sent the message.

The character is Server (not [Server], just Server which sends the message. But there is a problem. The answer-check system is quite different.

At first you have to write a pm to Server character to this message: key , then this Server character randomly sends 7 number code to you and wants you to reply this code to it(Server character).

I hope you get what is system like. What do you prefer to solve this check method or is there any plugin which can work for that one?

This may work. In your script add the command request_key where you want to send System the key message.

from phBot import *
import phBotChat

import re
from time import sleep

def request_key(args):
	phBotChat.Private('System', 'key')
	return 5

def handle_chat(t, player, msg):
	if len(player) == 0:
		m = re.findall(r'(\d+)', msg)
		if m and len(m) >= 2:

			if msg.find('+') != -1 or msg.find(' x ') != -1:
				result = int(m[0]) + int(m[1])
			else:
				result = int(m[0]) * int(m[1])

			sleep(1.0)

			log('Sending result %s' % str(result))
			if msg.find('/answer') != -1:
				phBotChat.All('/answer ' + str(result))
			else:
				phBotChat.All(str(result))
	elif player == 'RemoLogger' or player == 'Bot' or player == 'BotCheck' or player == 'System':
		m = re.findall(r'(\d+)', msg)
		if m:
			if len(m) == 1:

				sleep(1.0)

				log('Sending result %s' % str(m[0]))
				phBotChat.Private(player, str(m[0]))

			elif len(m) >= 2:

				if msg.find('+') != -1 or msg.find(' x ') != -1:
					result = int(m[0]) + int(m[1])
				else:
					result = int(m[0]) * int(m[1])

				sleep(1.0)

				log('Sending result %s' % str(result))
				phBotChat.Private(player, str(result))
		elif msg.lower().find('kervankey') != -1:
			sleep(1.0)
			phBotChat.Private(player, 'Kervankey')
	elif player.find('JobSecure') != -1:
		sleep(1.0)
		phBotChat.Private(player, str(get_character_data['job_current_exp']))

log('[%s] Loaded' % __name__)
1 Like

@Ryan BotCheck 1-999 Auto Answer
How can we do this?

The Mixed Number Between Pm is Coming.

Post a screenshot of the message it sends.

Ads%C4%B1z

There are already like 10 posts about this. Get Some String data from web site - #14 by Ryan

1 Like

@Ryan what exactly is that solutions

There isn’t one at the moment.

@Ryan Can’t you help?

Bro Answer to Job exp question plugin is not working good at regard-online.com

I can’t keep up with every implementation of the job question. You’ll have to write some code and make it work with whatever server you’re on.

2 Likes

Okey. Sorry… How can i learn how to make plugin and write some codes :=)

Plugins.phbot.org
Read the first page
“learning python”

1 Like

@Ryan This codes doesn’t work in CypherSro… Can you edit this codes for me ?

Questions all times same, single digits or double digits…

1

Why you don´t try it yourself? The Code from Ryan is just a Sample and has to be modified for each server…
Im not sure this will work and its not tested:

from phBot import *
import phBotChat

import re
from time import sleep

def handle_chat(t, player, msg):
	if len(player) == 0:
		m = re.findall(r'(\d+)', msg)
		if m and len(m) >= 2:

			if msg.find('+') != -1 or msg.find(' x ') != -1:
				result = int(m[0]) + int(m[1])
			else:
				result = int(m[0]) * int(m[1])

			sleep(1.0)

			log('Sending result %s' % str(result))
			if msg.find('/answer') != -1:
				phBotChat.All('/answer ' + str(result))
			else:
				phBotChat.All(str(result))
	elif (player.find('System') != -1) and msg.lower().find('soru:') != -1:
		s = msg.split(' ')
		answer = int(s[1])*int(s[3])
		sleep(1.0)
		phBotChat.Private(player, str(answer))

log('[%s] Loaded' % __name__)

This only works if the numbers are always in the same place!

1 Like

Hey Ryan,

Is there any plugin that clicks the message while teleporting? I am uploading the picture of the message.