Look Me error
Pyretic
03 Sept 2018, 21:36Getting this error when trying to use the question lib
Error running script: Error evaluating expression 'ListCount(lst) + 1': ListCount function expected list parameter but was passed 'Object: player'
any help would be appreciated
XanMag
04 Sept 2018, 00:11Did you by chance rename the player?
Pyretic
04 Sept 2018, 00:56I have not
Pyretic
04 Sept 2018, 00:57if it helps, the error pops up on the sample provided in the forum post for creating characters also
The Pixie
04 Sept 2018, 06:47Can you link to the forum post you are using? I am not sure what question lib is.
Pyretic
04 Sept 2018, 08:15"http://textadventures.co.uk /forum/samples/topic/5492/character-creation-questions-again"
had to put a space between the UK and /Forum
mrangel
04 Sept 2018, 08:37The error message says you have a problem in the expression ListCount(lst) + 1
.
That expression is not in any of the core code, and doesn't seem to be in that QuestionLib either. Can you find where that expression appears in your game?
Pyretic
04 Sept 2018, 09:03I haven't been able to find it, I have looked. As I have said, the error occurs in the sample QuestionDemo.aslx also when trying to look at yourself. I tried running through the QuestionLib also, but I am a bit out of my depth on trying to alter that code.
mrangel
04 Sept 2018, 09:20Best suggestion I can come up with is to open the aslx file in a text editor and search for that expression.
Maybe you could publish the game so we can see it? Finding the problem would probablky be easier than going back and forth with questions.
Pyretic
04 Sept 2018, 10:13the QuestionDemo.aslx that is included on the same post as before also gets the error and you can download it, if you would like to see the error, download it, and simply use look me after the character creation.
mrangel
04 Sept 2018, 10:34OK, this was a lot harder than it should have been because you misquoted the error message.
That QuestionLib includes a function named "IndexOf".
Since Quest 5.7, IndexOf is now a core function.
The two versions of the function do not behave the same (their parameters are reversed).
So, in the question lib file, you need to remove this function:
<function name="IndexOf" type="int" parameters="item, lst">
if (lst = null) lst = race.list
for (i, 0, ListCount(lst) - 1) {
if (StringListItem(lst, i) = item) {
return (i)
}
}
return (-1)
</function>
Then in the function SetTo
, change
index = IndexOf(value, lst)
to
index = IndexOf(lst, value)
and in AskQuestion
(near the bottom) change
index = IndexOf(result, item.list)
to
index = IndexOf(item.list, result)
Then I think it should work.
The Pixie
04 Sept 2018, 10:35It is an error in QuestionLib. There is a function in there called IndexOf
. As of Quest 5.7, there is a slightly different function IndexOf
in the core libraries, and there is a conflict.
To fix it, open QuestionLib with a text editor, such as Notepad, and search for IndexOf
. For each occurrence, change it to IndexOfQL
(should be three). I cannot update the post as the thread is now locked.