Jump to content
  • 0

Python script



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.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

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 by DnR
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

  • Create New...