dragonlord52 Posted December 14, 2009 Author Share Posted December 14, 2009 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: 9COLUMN: 0CODE: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 More sharing options...
Admiral Refuge Posted December 14, 2009 Share Posted December 14, 2009 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 More sharing options...
dragonlord52 Posted December 14, 2009 Author Share Posted December 14, 2009 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. Link to comment Share on other sites More sharing options...
Admiral Refuge Posted December 14, 2009 Share Posted December 14, 2009 @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 More sharing options...
dragonlord52 Posted December 14, 2009 Author Share Posted December 14, 2009 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 More sharing options...
Admiral Refuge Posted December 14, 2009 Share Posted December 14, 2009 @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 More sharing options...
dragonlord52 Posted December 14, 2009 Author Share Posted December 14, 2009 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 IfEnd Sub``` Link to comment Share on other sites More sharing options...
Ruins of Hell Posted December 15, 2009 Share Posted December 15, 2009 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 IfEnd Sub```Try again. Link to comment Share on other sites More sharing options...
dragonlord52 Posted December 15, 2009 Author Share Posted December 15, 2009 I still get an end of statement errorLine 2Column 17 Link to comment Share on other sites More sharing options...
Ruins of Hell Posted December 15, 2009 Share Posted December 15, 2009 ```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 IfEnd Sub```Fixed. Link to comment Share on other sites More sharing options...
dragonlord52 Posted December 15, 2009 Author Share Posted December 15, 2009 Ugh, now it give me the errorTYPE: Type mismatch: 'CInt'LINE: 5COLUMN: 0CODE: Link to comment Share on other sites More sharing options...
Admiral Refuge Posted December 15, 2009 Share Posted December 15, 2009 @dragonlord52:> Ugh, now it give me the error> > TYPE: Type mismatch: 'CInt'> LINE: 5> COLUMN: 0> CODE:Replace CInt with Int Link to comment Share on other sites More sharing options...
dragonlord52 Posted December 15, 2009 Author Share Posted December 15, 2009 Now I get this error:TYPE: Type mismatch: 'Quest_Status'LINE: 5COLUMN: 0CODE: Link to comment Share on other sites More sharing options...
Admiral Refuge Posted December 15, 2009 Share Posted December 15, 2009 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 IfEnd Sub``` Link to comment Share on other sites More sharing options...
dragonlord52 Posted December 16, 2009 Author Share Posted December 16, 2009 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 IfEnd Sub``` Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now