RSilkroad

@Ryan
changed asks% Rsilkroad New answer Jop Help Me?SRO%5B2019-06-21%2000-38-08%5D_57

1 Like

Math basic :face_with_monocle: … But there is :

character = get_character_data()
JobExpPercentage = int( character['job_current_exp'] * 100 / character['job_max_exp'] )
4 Likes

i tried every combination but still can’t make it work help pls :confused:

Reply has to be a str.

i tried that as well it says character not defined. sometimes it doesn’t load i don’t know where to add character = and JobExpPercentage

Missing this above reply.

Answer

            character = get_character_data()
            JobExpPercentage = int( character['job_current_exp'] * 100 / character['job_max_exp'] )
            reply = str(get_character_data()["job_current_exp"]) ( character['job_current_exp'] * 100 / character['job_max_exp'] )

like this ?

now it says : Plugin: example.py has failed to load

You’re duplicating things for no reason.

character = get_character_data()
reply = str(int(character['job_current_exp'] * 100 / character['job_max_exp']))

yea same error after i did this :frowning: has failed to load

Post your existing code.

i made it default it wasn't working this is the code i was using before update that was asking for job (exp)

from phBot import *
import phBotChat
from time import sleep

log("Plugin: JobSecure successfully loaded.")

# All chat messages received are sent to this function
def handle_chat(t, player, msg):
	if player:
		# System nickname
		if player == "BotCheck":
			# Question
			if "job exp" in msg.lower():
				# Answer
				reply = str(get_character_data()["job_current_exp"])
				# Reply
				sleep(1.0)
				phBotChat.Private(player,reply)
				log("Plugin: Reply the answer ["+reply+"]")
2 Likes
from phBot import *
import phBotChat
from time import sleep

# All chat messages received are sent to this function
def handle_chat(t, player, msg):
	if player:
		# System nickname
		if player == "BotCheck":
			# Question
			if "job exp" in msg.lower():
				# Answer
				character = get_character_data()
				reply = str(int(character['job_current_exp'] * 100 / character['job_max_exp']))
				# Reply
				sleep(1.0)
				phBotChat.Private(player, reply)
				log('Plugin: Reply %s' % (reply))

log("Plugin: JobSecure successfully loaded.")
2 Likes

i did the same it was failing i have to learn how to code correctly ur the best man thanks !!

1 Like

Ryan ‘’ Phython error ‘’ : division by zero error help

errrrr

Your EXP is 0 and you obviously cannot divide by 0.

from phBot import *
import phBotChat
from time import sleep

# All chat messages received are sent to this function
def handle_chat(t, player, msg):
	if player:
		# System nickname
		if player == "BotCheck":
			# Question
			if "job exp" in msg.lower():
				# Answer
				character = get_character_data()
				reply = '0' if character['job_current_exp'] == 0 else str(int(character['job_current_exp'] * 100 / character['job_max_exp']))
				# Reply
				sleep(1.0)
				phBotChat.Private(player, reply)
				log('Plugin: Reply %s' % (reply))

log("Plugin: JobSecure successfully loaded.")

My JOB EXP %69 while buying phyton error : division by zero

Then something else is 0 like job level EXP. You’re using testing right?

Copy and paste into example file you code

reply = '0' if character['job_max_exp'] == 0 else str(int(character['job_current_exp'] * 100 / character['job_max_exp']))	

You have to use testing.