Do commands only work with objects or can I use a command to pass a text option to code?
For example. My game has several attributes related to skills. I want to create a command called 'Learn #text#' where the text is a name of one of the skills. This will execute code that will let the player spend available experience to learn a skill. I tried 'Learn #text#', but when I tried using ListContains (game.skills, text) the program died saying I was passing ListContains a null value.
That should work. Try temporarily adding these lines at the start of the command script.
msg("text type=" + TypeOf(text)) msg("text=" + text)
That will you what text is (the type, then the value), so you can tell if that bit works or not.
Yeah. It's not working. I get this message.
Error running script: Error evaluating expression 'ListContains (game.skills, s) or ListContains (game.disabledskills, s)': ListContains function expected list parameter but was passed 'null'
fyi my code contains s = CapFirst(text), so I am changing text to a variable, which is working, it's pulling in the text, it's just my ListContains doesn't see it.
So we know
text is a string, with the value "Agility", so that part is working.
The error message actually says "expected list parameter", so it is the first parameter that is null,
game.disabledskills. Have you created these lists somewhere?
I'm a dummy. Sorry to waste everyone's time. I figured it out. Thank you.
No... You are a learner...
A dummy never learns...
(But, you can make dumb mistakes... that's called learning...)
So... for the rest of us "learners", what was your fix?