Page 1 of 1
problem with syntax or not?
Posted: Mon Jul 18, 2011 3:27 pm
by zippel
The scripts are doesn't work correctly after I replaced onTalk for onFirstTalk.
For example, this opens up only 1.htm
However, the further it takes no action, if you try to use it.
In logs no errors.
Code: Select all
def onFirstTalk (self,npc,player): st = player.getQuestState(qn) htmltext = "<html><head><body><center>Some text...</center></body></html>" st.setState(State.STARTED) return InitialHtml
Re: problem with syntax or not?
Posted: Mon Jul 18, 2011 3:55 pm
by AntV
If you only want to use onFirstTalk, do not add a setState in there, otherwise the player will have a quest state next time he speaks, hence it won't call onFirstTalk, but onTalk.
Re: problem with syntax or not?
Posted: Mon Jul 18, 2011 4:10 pm
by zippel
AntV wrote:If you only want to use onFirstTalk, do not add a setState in there, otherwise the player will have a quest state next time he speaks, hence it won't call onFirstTalk, but onTalk.
What I must write, help me - I'm novice...
I'm removed this line (where st.setState(State.STARTED)) - and no effect...
Re: problem with syntax or not?
Posted: Mon Jul 18, 2011 5:48 pm
by lion
look in other quest what use py, try test etc, not all time ask, you never learn smt if you all time would ask. I'm already give answer in other forum to you, and you don't want think
Re: problem with syntax or not?
Posted: Mon Jul 18, 2011 7:23 pm
by zippel
lion wrote:look in other quest what use py, try test etc, not all time ask, you never learn smt if you all time would ask. I'm already give answer in other forum to you, and you don't want think
mda

Re: problem with syntax or not?
Posted: Mon Jul 18, 2011 7:53 pm
by jurchiks
@AntV - setState does not affect onFirstTalk, it's called every time you click on the NPC, has nothing to do with quest states.
Code: Select all
def onFirstTalk(self,npc,player): return "<html><body><center>Some text...</center></body></html>" # or "1.htm", or InitialHtml
You don't need to set the state there as you do not use it. Don't just copy-paste other code, THINK what it does and if you even need it!
Re: problem with syntax or not?
Posted: Mon Jul 18, 2011 9:22 pm
by AntV
jurchiks wrote:@AntV - setState does not affect onFirstTalk, it's called every time you click on the NPC, has nothing to do with quest states.
Really? Sorry then, my mistake, but I thought it is called on the first time you talk to the npc at the current state... I t seems I have to study the quests a bit more

Re: problem with syntax or not?
Posted: Tue Jul 19, 2011 1:08 pm
by jurchiks
There is no need to set the state in onFirstTalk unless you absolutely require a certain state, and this isn't the case.
And onFirstTalk is not linked in any way with quest states, it is simply called when you first talk to an NPC provided he's bound to this event (if I remember correctly, addFirstTalkId(npcId)).