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.
Original was based off L2OFF, so how would he even be able to compete or deliver the same quality? It will be just another L2F from shein.
Whatsoever, some times you should just let the horse die.
Bump
NEW USER IN TELEGRAM AND DISCORD IS "mileanum"
NEW USER IN TELEGRAM AND DISCORD IS "mileanum"
NEW USER IN TELEGRAM AND DISCORD IS "mileanum"
NEW USER IN TELEGRAM AND DISCORD IS "mileanum"
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.