Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Quest Editor Problem
#1
Well it feels like ive been posting alot now but im just a newbie Big Grin
Ive been trying to add a quest editor lately. I basically took whatever Item Editor had and duplicated and put in my own variables and changed names. I thought it would work then i test it out and i get this error that says:
Code:
Compile Error:
Sub or Function not defined.
Im thinking it cant read that its in a sub or that the spacing is wrong. thats what i THINK at least.
heres the code i got for the Quest Editor Packet. It comes up that error. I mean i got no clue it says the sub right at the top.
Its in the server side on ModHandleData
Everyone is okay in that packet just when it comes to the quest(n).name=Parse(2) it says that error up top.

Code:
' ::::::::::::::::::::::
    ' :: Quest Packet:::::::
    ' ::::::::::::::::::::::
    If LCase(Parse(0)) = "savequest" Then
        ' Prevent hacking
        If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
            Call HackingAttempt(Index, "Admin Cloning")
            Exit Sub
        End If
        
        n = Val(Parse(1))
        If n < 0 Or n > MAX_QUESTS Then
            Call HackingAttempt(Index, "Invalid Item Index")
            Exit Sub
        End If

        ' Update the item
        Quest(n).Name = Parse(2)
        Quest(n).SayStart = Parse(3)
        Quest(n).NotReady = Parse(4)
        Quest(n).Completed = Parse(5)
        Quest(n).AlreadyDone = Parse(6)
        Quest(n).GiveExp = Val(Parse(7))
        Quest(n).GiveItem = Val(Parse(8))
        Quest(n).GiveItemVal = Val(Parse(9))
        Quest(n).TakeItem = Val(Parse(10))
        Quest(n).TakeItemVal = Val(Parse(11))
        Quest(n).NpcStart = Val(Parse(12))
        Quest(n).ItemStart = Val(Parse(13))

        
        ' Save it
        Call SendUpdateQuestToAll(n)
        Call SaveQuest(n)
        Call AddLog(GetPlayerName(Index) & " saved quest #" & n & ".", ADMIN_LOG)
        Exit Sub
    End If
Reply
#2
Nobody knows?
Reply
#3
Your Sub or Function that you are trying to call is not defined... What does it highlight?
Reply
#4
Code:
' Update the item
        Quest(n).Name = Parse(2)
        Quest(n).SayStart = Parse(3)
        Quest(n).NotReady = Parse(4)
        Quest(n).Completed = Parse(5)
        Quest(n).AlreadyDone = Parse(6)
        Quest(n).GiveExp = Val(Parse(7))
        Quest(n).GiveItem = Val(Parse(8))
        Quest(n).GiveItemVal = Val(Parse(9))
        Quest(n).TakeItem = Val(Parse(10))
        Quest(n).TakeItemVal = Val(Parse(11))
        Quest(n).NpcStart = Val(Parse(12))
        Quest(n).ItemStart = Val(Parse(13))

It only highlights the first line about quest but thats because thats the first error it gets. Its pretty much the whole quest thing isnt defined. And it has the Sub thing at the top.
Reply
#5
did you define all of them in QuestRec?
Reply
#6
You shouldnt have to. The variable is defining like a data thing.
Reply
#7
addy Wrote:You shouldnt have to. The variable is defining like a data thing.

lolwut. You seem so sure of yourself but your argument makes no sense.

This is what Forte was talking about, and I'm willing to bet it's what you're missing:

Code:
Type QuestRec
        Name As String
        SayStart As String
        NotReady As Byte
        Completed As Byte
        AlreadyDone As Byte
        GiveExp = As Integer
        GiveItem As Byte
        GiveItemVal As Byte
        TakeItem As Byte
        TakeItemVal As Byte
        NpcStart As Byte
        ItemStart As Byte
End Type
Reply
#8
Nope that wasnt it. I tried it and i thought it was going to work but i guess not.
Things i guess that MIGHT just help you.
The server opens up and it works but that error only pops up when i turn on the game and try logging in.
Then it stops the game and the server it just pauses.

Then the .thing here at all its just the first part gets highlighted. Its just the Quest part not the (n).sayStart or whatever the case would be.
Reply
#9
Public Quest as questrec

Something like that maybe?
Reply
#10
Nope not it. I dont think its because its not defined so it shouldnt be that Questrec thing.
Its because it doesnt think its in a Sub and its all alone.
I think its the placing but im not sure.
Hopefully someone will figure out or ill have to rewrite and write a thing from scratch
Reply
#11
Public Map As MapRec

That right there, is what allows you to do map.name and such.

You need one for the questrec, otherwise you'll never get it to work.

Your questrec is needed, first off, because you're trying to use a user defined type (UDT) and it has to be defined. Then, you have to define something else, AS that UDT, in order to use the UDT. Without that, it won't work.

That's most likely your issue.

Other examples:

Public TempTile(0 To MAX_MAPX, 0 To MAX_MAPY) As TempTileRec
Public Player(1 To MAX_PLAYERS) As PlayerRec
Public Class() As ClassRec
Public Item(1 To MAX_ITEMS) As ItemRec
Public Npc(1 To MAX_NPCS) As NpcRec
Public MapItem(1 To MAX_MAP_ITEMS) As MapItemRec
Public MapNpc(1 To MAX_MAP_NPCS) As MapNpcRec
Public Shop(1 To MAX_SHOPS) As ShopRec
Public Spell(1 To MAX_SPELLS) As SpellRec
Reply
#12
Perfekt, i dont know how your always right ha.
Well you got it thanks for everybody's help.
Reply
#13
I'm hardly always right. Lol. Ask Lea and Robin. They both know. XD

I just looked at your problem, looked at Rian's suggestion, and figured it out. Big Grin
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)