Unexpected keyword_when

Status
Not open for further replies.

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
263
Reaction score
218
First Language
English
Primarily Uses
RMVXA
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
 
Last edited by a moderator:

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
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.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
You likely deleted something. Like a `case`
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
263
Reaction score
218
First Language
English
Primarily Uses
RMVXA
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:
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
263
Reaction score
218
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
263
Reaction score
218
First Language
English
Primarily Uses
RMVXA
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
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    #//////////////////////////////////////////////////////////////////////
 

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
263
Reaction score
218
First Language
English
Primarily Uses
RMVXA
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[:objectives][0] = "Talked 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 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[:objectives][0] = "Talked to Drew"q[:objectives][1] = "Get Water from Inn"q[:objectives][2] = "Return to Drew with Water"q[:prime_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
 

Ninjakillzu

Veteran
Veteran
Joined
Aug 19, 2013
Messages
263
Reaction score
218
First Language
English
Primarily Uses
RMVXA
I just solved the problem. Thanks for all of the help!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top