XP = 0
nmin = 50
nmax = 2000
getxp = []
f = open("users/" + user.name.lower() + ".txt", 'r')
xpg = f.readline().split("X Points = ",1)[1]
f.close
elif used_prefix and cmd == "dailychance" or "dc":
if self.getAccess(user) >=1:
ngnum = str(random.randrange(nmin,nmax))
getxp
XP += ngnum
room.message("Old XP = " + xpg[0])
xpg[1] = XP
room.message("New XP = " + xpg[1])
f.writeline(xpg[1])
XP = 0
else:
room.message("You are not Whitelisted. >=( ")
I want it to get a random number between those min and max and then assign the number to ngnum then add ngnum to XP then send a message Old Xp = The old value then change the value to the new one then send the message New XP = new value then rewrite the old value to the new one.
xpgis a string (xpg = f.readline().split("X Points = ",1)[1]) and strings are immutable in Python - therefore it fails onxpg[1] = XP. Can you show us what is the input (the file) and expected output?