This is the code i'm trying to use to write to a text from a quest script
import math
import sys
from java.io import *
from com.l2jserver.gameserver import Announcements
from com.l2jserver.util import Rnd
from java.lang import System
from com.l2jserver.gameserver.model.quest import State
from com.l2jserver.gameserver.model.quest import QuestState
from com.l2jserver.gameserver.model.quest.jython import QuestJython as JQuest
from com.l2jserver.gameserver.model.actor.instance import L2PcInstance
from com.l2jserver.gameserver.model.actor.instance import L2NpcInstance
from com.l2jserver.gameserver.network.serverpackets import PlaySound
from com.l2jserver.gameserver.model.itemcontainer import Inventory
from com.l2jserver.gameserver.network.serverpackets import MagicSkillUse
from com.l2jserver.gameserver.network.serverpackets import MagicSkillLaunched
from com.l2jserver.gameserver.network.serverpackets import NpcHtmlMessage
from com.l2jserver.gameserver.network.serverpackets import ActionFailed
from com.l2jserver.gameserver.network.serverpackets import ExShowScreenMessage
from com.l2jserver.gameserver.model import L2World
from com.l2jserver.gameserver.network.serverpackets import ExRedSky
from com.l2jserver.gameserver.network.serverpackets import Earthquake
from com.l2jserver.gameserver.datatables import SkillTable
#Enter information about NPCs interested in the event
MANAGER = 654321
#Quest Name
qn = "Lottery"
class Lottery (JQuest):
def __init__(self,id,name,descr):
JQuest.__init__(self,id,name,descr)
def onTalk (self,npc,player):
return "answerme.htm"
def onAdvEvent (self,event,npc,player):
if event.startswith("numbers"):
output = BufferedWriter(FileWriter("numbers.txt"))
output.write( "Hello" )
QUEST = Lottery(-1, qn, "custom")
QUEST.addStartNpc(MANAGER)
QUEST.addTalkId(MANAGER)
print "[EVENT] Lottery LOADED SUCCESFULLY"
The event load succesfully, NPC is working. When i click on the event (to activate the onAdvEvent) nothing happens. With nothing i mean the text is not printed into the file.
The event is correctly triggered because i tried it by adding a <return "Hello"> into the <if event.startswith("numbers"):>
I tried using also python modules for file writing without succes...i really need some help from pro ppl :P
Thanks in advance
PS: The numbers.txt files already exixst and is not "Read Only"
EDIT
This is not working either
def onAdvEvent (self,event,npc,player):
if event.startswith("numbers"):
f = open("numbers.txt","w")
f.write("ciao")
f.close()
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Hello. You may encounter the Push item fail error when trying to pick up an item dropped on the ground by a mob.
or
You can throw something out of your inventory and pick it up again, several times.
Probably this is a quantum dependency) I don't understand at what point this happens, sometimes two items one after another experience push item errors, and sometimes I don't have enough thousands of attempts to repeat this trick)
In any case, this is just a visual error and after the relog, the item appears in the inventory. I think first i need to disconnect the extender and check it on a bare server. I still need time to check this, maybe it's not even about the autoloot function.
https://youtu.be/6mcfmdImofE
-----------
In general, I would like to thank our wonderful Emca Eressea for her deep knowledge in programming and reverse engineering. And for the fact that her work is open to everyone, this is very amazing, and incredibly valuable.
ADENA
500 K = 40e
1kk = 70e
3kk = 190e
ITEMS
staff of life = 150e
karmian set = 90e
elven jewls top D = 30e
Orcish Poleaxe+1 best C pole = 680e
any D grade armor on demand
discord
wiz0642_81242
Question
davide874
Hi all,
This is the code i'm trying to use to write to a text from a quest script
The event load succesfully, NPC is working. When i click on the event (to activate the onAdvEvent) nothing happens. With nothing i mean the text is not printed into the file.
The event is correctly triggered because i tried it by adding a <return "Hello"> into the <if event.startswith("numbers"):>
I tried using also python modules for file writing without succes...i really need some help from pro ppl :P
Thanks in advance
PS: The numbers.txt files already exixst and is not "Read Only"
EDIT
This is not working either
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.