Unexpected keyword_when

I just got Modern Algebra's quest journal script to use in my RPG for VXA. I have very little experience with scripts except with plug and play ones. I am having trouble getting my first quest for the journal to work.

I made a new quest and put it in a new script page, but when I run the game I get this error:

Script 'Quest 1' line 1: SyntaxError occured.

unexpected keyword_when

      when 1 # Quest 1

Here is the script in question:

Code:
   when 1 # Quest 1        q[:name]              = "Spellbook for Rachel"        q[:icon_index]        = 0        q[:level]             = 1        q[:description]       = "Get the red spellbook from Drew"        q[:objectives][0]     = "Talk to Rachel"        q[:objectives][1]     = "Talk to Drew"        q[:objectives][2]     = "Get Water for Drew from the Arcaina Town Inn"        q[:obkectives][3]     = "Take spellbook to Rachel"        q[:prime_objectives]  = [0, 1, 3]        q[:client]            = "Rachel"        q[:location]          = "Arcaina Town Mage Acadamy"        q[:rewards]           = [          [:exp, 50],          [:item, 5,1],          ]        q[:layout]            = false
First, please put the code in code tag. It looks like <>, and is next to the image and quote buttons.

Secondly, is there more to the script? Please post the whole script, or we will not be able to help you.
You likely deleted something. Like a `case`
It looks to me like you have deleted half the script.


Even if it was just one line missing ... NO script begins with case.


Go back to where you downloaded it, and get the WHOLE script and paste into your game (delete the one that's already there, otherwise you'll potentially end up with two and will have even more errors).


Then if it still doesn't work, post a link to the page where you downloaded the script.
I am not even sure if I am putting the code into the right area. The directions of Modern Algebra's quest journal are not clear where to put the data for each quest. That's all the code for the quest. I got it from here, then put the new quest code under a new script page:
I removed the script. I already told you to put a LINK to where you downloaded it from. There are a number of reasons for this, which I won't go into.


But I already saw, line 1 of that script is NOT a 'when' statement. So the script in your game is NOT the same as the one you just posted here.
I removed the script. I already told you to put a LINK to where you downloaded it from.
I was editing my post at the same time you added the new reply. I got rid of the entire old script and got it again. It still didn't work.

Here is where I got the quest journal script from: http://rmrk.net/index.php/topic,45127.0.html

The script I have in my first post is a template of script from the quest journal I messed with to make a quest. I then put the edited script template in a new script page because the directions on the quest journal master script are not clear what to do with new quest data. I also don't know what this "case" being mentioned means.
WHEN is a keyword that follows a CASE statement. WHEN could not be the first line of your script, if your script is correct.


You need to copy the whole script into your project, then use that template to make new quests, and put them in the same place as the script indicates.


Remove any "mucking around" scripts you created - the engine will still be trying to run them.
Ok, so I added the edited template to where it is supposed to be (I think) and the game doesn't crash anymore at the title. I still can't seem to get the quest to activate though.

I followed the script instructions and even downloaded a demo so I could see an example of the script. When I put

reveal_objective(1, 0, 1)in the quest I want to activate, it gives me this error:

Script 'Game_Interpreter' line 1411: NoMethodError occured.

undefined method `[]=' for nil:NilClass

The edited template is still the same as originally posted.
then put the new quest code under a new script page:
That is your mistake - you need to edit the quest journal script, NOT create new script pages.Your quest info needs to go into the same place of modern algebra's script like the example quest info, only below it but before the next areas.

Code:
  when 1 #quest 1#quest data for quest 1  when 2 # quest 2#quest data for quest 2  when 3#quest data for quest 3  when 4#quest data for quest 4    #||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||    #  END Editable Region B    #//////////////////////////////////////////////////////////////////////
That is your mistake - you need to edit the quest journal script, NOT create new script pages.

Your quest info needs to go into the same place of modern algebra's script like the example quest info, only below it but before the next areas.

when 1 #quest 1#quest data for quest 1 when 2 # quest 2#quest data for quest 2 when 3#quest data for quest 3 when 4#quest data for quest 4 #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| # END Editable Region B #//////////////////////////////////////////////////////////////////////
I have done that already. Here is what it looks like:

when 1 # Quest 1 - Spellbook For Rachelq[:name] = "Spellbook for Rachel"q[:icon_index] = 0q[:level] = 1q[:description] = "Get the red spellbook from Drew"q[😮bjectives][0] = "Talked to Rachel"q[😮bjectives][1] = "Talk to Drew"q[😮bjectives][2] = "Get Water for Drew from the Arcaina Town Inn"q[😮bkectives][3] = "Take spellbook to Rachel"q[😛rime_objectives] = [0, 1, 3]q[:client] = "Rachel"q[:location] = "Arcaina Town Mage Acadamy"q[:rewards] = [ [:exp, 50], [:item, 5,1],]q[:layout] = false when 2 # Quest 1 - Get Water for Drewq[:name] = "Get Water for Drew"q[:icon_index] = 0q[:level] = 1q[:description] = "Get the red spellbook from Drew"q[😮bjectives][0] = "Talked to Drew"q[😮bjectives][1] = "Get Water from Inn"q[😮bjectives][2] = "Return to Drew with Water"q[😛rime_objectives] = [0, 1, 2]q[:client] = "Drew"q[:location] = "Arcaina Town Mage Acadamy"q[:rewards] = []q[:layout] = false #|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| # END Editable Region B #//////////////////////////////////////////////////////////////////////If that is wrong, then let me know. I am still getting this error:

Script 'Game_Interpreter' line 1411: NoMethodError occured.

undefined method `[]=' for nil:NilClass
I just solved the problem. Thanks for all of the help!
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/unexpected-keyword_when.24653/