egzistas Posted July 18, 2019 Posted July 18, 2019 Hello I was coding, everything was ok till i started to put this : def testas() : test = "ane" if player.isGm() : test = "jo"; return test In another code sections it´s working perfectly... def onFirstTalk (self,npc,player): st = player.getQuestState(QUEST_LOADING_INFO) if not st : st = self.newQuestState(player) if player.isGM(): .............. Yes, i tried to put player in testas(player) same poop.
0 DenArt Designs Posted July 18, 2019 Posted July 18, 2019 why python? everything works on java its 2019 :D onFirstTalk exist on core while testas no
0 DnR Posted July 18, 2019 Posted July 18, 2019 (edited) You seem to have zero knowledge regarding Python OOP, so I suggest you take a small look here: https://www.w3schools.com/python/python_classes.asp For start, try calling your new method using 'self' reference which is almost equivalent to Java's 'this' reference. Also, there must be an extra first parameter that refers to current object and exists solely to give you access to it. In most cases, developers name it self. So, your method parameters should look like this: def testas(self, player): and you should call it like this: self.test(player) *Note: Do not use semicolons in Python. I hope you find these tips helpful. Edited July 18, 2019 by DnR
Question
egzistas
Hello I was coding, everything was ok till i started to put this :
def testas() :
test = "ane"
if player.isGm() :
test = "jo";
return test
In another code sections it´s working perfectly...
def onFirstTalk (self,npc,player):
st = player.getQuestState(QUEST_LOADING_INFO)
if not st : st = self.newQuestState(player)
if player.isGM():
..............
Yes, i tried to put player in testas(player) same poop.
2 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now