Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[ES] Werid error


dragonlord52
 Share

Recommended Posts

I don't know if this is an ES only error or if its also in EE 2.7 but does anyone know why it does this?

This is the line that errors out
```
Quest_Status = GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "QUEST", GetPlayerMap(Index))
```
There is as follows:

TYPE: Type mismatch: '[string:""]'
LINE: 9
COLUMN: 0
CODE:

I had tried dimming it and I have looked over this code again and again. If I comment the line out the script works just fine but if I try to put it back in it errors on me.

Any ideas?

Thanks,
Slash

~-EDIT-~
If something exists in that spot it doesn't error but if nothing is there it errors. You'll need that information to replicate it.
Link to comment
Share on other sites

Are you using the variable "Quest_Status" as a string, or integer?

If you're using it as an integer (e.g. "If Quest_Status = 3"), it need to be converted into an integer, since GetVar returns a string.

```
Quest_Status = Int(GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "QUEST", GetPlayerMap(Index)))

```
Link to comment
Share on other sites

@dragonlord52:

> I use it for this
> ```
> If (Quest_Status <> "") Then
> ```
> But it gives that error in general. I have another one just like it but going to a different area and it works fine which is why I am confused.
>
> ~-EDIT-~
>
> I tried what you posted and I get the exact same error.

Do all of your if statements contain parentheses? Though it will probably work, it's not vbscript-style to use them when compare If-Then.

From looking at that statement, you're comparing it to a string (notice the quotes ""), which means that Quest_Status needs to be converted to a string, rather than an integer.

This may work:
```
Quest_Status = CStr(GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "QUEST", GetPlayerMap(Index)))

```
Link to comment
Share on other sites

I still get the same error.

Oh and I deleted the If statement as well (not commented out) but when I put the deceleration for the variable Quest_Status I get that error, dunno why that is.

The () on my If statements do work, I use it on all of my scripts. I guess its habit from taking my C++ class.
Link to comment
Share on other sites

@dragonlord52:

> I still get the same error.
>
> Oh and I deleted the If statement as well (not commented out) but when I put the deceleration for the variable Quest_Status I get that error, dunno why that is.
>
> The () on my If statements do work, I use it on all of my scripts. I guess its habit from taking my C++ class.

Interesting..
So the error actually comes up when you first dim the variable?

Try converting it to a string first, e.g.
Dim Quest_Status = CStr(0)

Or if possible, could you provide the whole segment of the code?

PS: I know what you mean, I'm a c++ programmer myself.
Link to comment
Share on other sites

I tried what you just posted and it gives me an end of statement expected error.

Anyway, here is the entire code I have, got this far before it started erroring.

```
Sub Quest(Index)
Dim Quest_Status = CStr(0)

NPC_Name = GetVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name")
If (NPC_Name <> "" ) Then
Quest_Status = CStr(GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "QUEST", GetPlayerMap(Index)))

Select Case Quest_Status
Case 1
Exit Sub

Case 2
Exit Sub

Case 3
Exit Sub

Case 4
Exit Sub
End Select
Else
Call PlayerMsg(Index, "Fat Man Inc. Scripts:", 14)
Call PlayerMsg(Index, "A Configuration File has been created in", 14)
Call PlayerMsg(Index, "scripts\mapextras\" & GetPlayerMap(Index) & ".ini", 14)

Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Quest_Name", "Test Quest Name")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name", "Test Name")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Start__Quest_Message", "You started a quest.")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "During_Quest_Message", "You are on a quest.")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Complete_Quest_Message", "You have completed a quest.")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "After_Done_Quest_Message", "You already did this quest.")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Amount_of_Items_Needed", 1)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Number", 1)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Value", 1)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Number", 0)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Value", 0)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Repeatable", 0)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_On", 0)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_File", "critical.wav")
End If

End Sub
```
Link to comment
Share on other sites

Won't work:

```
Sub Quest(Index)
  Dim Quest_Status = CStr(0)

  NPC_Name = GetVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name")
  If (NPC_Name <> "" ) Then
      Quest_Status = GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "QUEST", GetPlayerMap(Index))

      Select Case CInt(Quest_Status)
        Case 1
            Exit Sub

        Case 2
            Exit Sub

        Case 3
            Exit Sub

        Case 4
            Exit Sub
      End Select
  Else
      Call PlayerMsg(Index, "Fat Man Inc. Scripts:", 14)
      Call PlayerMsg(Index, "A Configuration File has been created in", 14)
      Call PlayerMsg(Index, "scripts\mapextras\" & GetPlayerMap(Index) & ".ini", 14)

      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Quest_Name", "Test Quest Name")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name", "Test Name")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Start__Quest_Message", "You started a quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "During_Quest_Message", "You are on a quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Complete_Quest_Message", "You have completed a quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "After_Done_Quest_Message", "You already did this quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Amount_of_Items_Needed", 1)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Number", 1)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Value", 1)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Number", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Value", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Repeatable", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_On", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_File", "critical.wav")
  End If

End Sub

```
Try again.
Link to comment
Share on other sites

```
Sub Quest(Index)
  NPC_Name = GetVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name")
  If (NPC_Name <> "" ) Then
      Quest_Status = GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "QUEST", GetPlayerMap(Index))

      Select Case CInt(Quest_Status)
        Case 1
            Exit Sub

        Case 2
            Exit Sub

        Case 3
            Exit Sub

        Case 4
            Exit Sub
      End Select
  Else
      Call PlayerMsg(Index, "Fat Man Inc. Scripts:", 14)
      Call PlayerMsg(Index, "A Configuration File has been created in", 14)
      Call PlayerMsg(Index, "scripts\mapextras\" & GetPlayerMap(Index) & ".ini", 14)

      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Quest_Name", "Test Quest Name")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name", "Test Name")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Start__Quest_Message", "You started a quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "During_Quest_Message", "You are on a quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Complete_Quest_Message", "You have completed a quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "After_Done_Quest_Message", "You already did this quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Amount_of_Items_Needed", 1)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Number", 1)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Value", 1)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Number", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Value", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Repeatable", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_On", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_File", "critical.wav")
  End If

End Sub

```
Fixed.
Link to comment
Share on other sites

Try this:
```
Sub Quest(Index)
  Dim Quest_Status
  Dim NPC_Name

  NPC_Name = CStr(GetVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name"))
  If (NPC_Name <> "" ) Then
      Quest_Status = GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "QUEST", GetPlayerMap(Index))

      Select Case Int(Quest_Status)
        Case 1
            Exit Sub

        Case 2
            Exit Sub

        Case 3
            Exit Sub

        Case 4
            Exit Sub
      End Select
  Else
      Call PlayerMsg(Index, "Fat Man Inc. Scripts:", 14)
      Call PlayerMsg(Index, "A Configuration File has been created in", 14)
      Call PlayerMsg(Index, "scripts\mapextras\" & GetPlayerMap(Index) & ".ini", 14)

      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Quest_Name", "Test Quest Name")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name", "Test Name")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Start__Quest_Message", "You started a quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "During_Quest_Message", "You are on a quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Complete_Quest_Message", "You have completed a quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "After_Done_Quest_Message", "You already did this quest.")
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Amount_of_Items_Needed", 1)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Number", 1)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Value", 1)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Number", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Value", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Repeatable", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_On", 0)
      Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_File", "critical.wav")
  End If

End Sub

```
Link to comment
Share on other sites

After looking through various quest scripts on the forums I have come up with this solution that DOES work.

```
Sub Quest(Index)
On Error Resume Next

NPC_Name = GetVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name")
If (NPC_Name <> "" ) Then
Quest_Status = GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "QUEST", GetPlayerMap(Index))
If (Quest_Status < 0) Then
Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "QUEST", GetPlayerMap(Index), 1)
End If

Select Case Quest_Status
Case 1
Exit Sub

Case 2
Exit Sub

Case 3
Exit Sub

Case 4
Exit Sub
End Select
Else
Call PlayerMsg(Index, "Fat Man Inc. Scripts:", 14)
Call PlayerMsg(Index, "A Configuration File has been created in", 14)
Call PlayerMsg(Index, "scripts\mapextras\" & GetPlayerMap(Index) & ".ini", 14)

Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Quest_Name", "Test Quest Name")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "NPC_Name", "Test Name")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Start__Quest_Message", "You started a quest.")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "During_Quest_Message", "You are on a quest.")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Complete_Quest_Message", "You have completed a quest.")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "After_Done_Quest_Message", "You already did this quest.")
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Amount_of_Items_Needed", 1)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Number", 1)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_1_Value", 1)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Number", 0)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Item_2_Value", 0)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Repeatable", 0)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_On", 0)
Call PutVar("Maps\map" & GetPlayerMap(Index) & ".ini", "QUEST", "Sound_File", "critical.wav")
End If

End Sub
```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...