@Ryan
changed asks% Rsilkroad New answer Jop Help Me?
Math basic ⌠But there is :
character = get_character_data()
JobExpPercentage = int( character['job_current_exp'] * 100 / character['job_max_exp'] )
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 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+"]")
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.")
i did the same it was failing i have to learn how to code correctly ur the best man thanks !!
Ryan ââ Phython error ââ : division by zero error help
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.