Script Error. Checking player gender.

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
I try to run the following code but received this error message and was wondering if anybody could spot what is wrong?
Code:
◆Script:if ($gameCharacterCreations.hasInfo(1)) {
:      :if ($gameCharacterCreations.getInfo(1).Body.file == 'Body (1)){
:      :$gameSwitches.setValue(45, true);
:      :}
:      :else if ($gameCharacterCreations.getInfo(1).Body.file == 'Body (2)){
:      :$gameSwitches.setValue(46, true);
:      :}
:      :else{
:      :$gameSwitches.setValue(45, false);
:      :$gameSwitches.setValue(46, false);
:      :}
:      :}
 

Attachments

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
[mod]I think this is probably better in the forum looking at Javascript, rather than the general one. So moving this to Javascript/Plugin Support[/mod]
 

Ahuramazda

Veteran
Veteran
Joined
Nov 9, 2012
Messages
262
Reaction score
127
First Language
English
Primarily Uses
RMMZ
first thing that stands out to me is you're missing another ' after body in your condition branches...
if ($gameCharacterCreations.getInfo(1).Body.file == 'Body (1))
if ($gameCharacterCreations.getInfo(1).Body.file == 'Body' (1))

try fixing both instances of that and see if that works
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
first thing that stands out to me is you're missing another ' after body in your condition branches...

if ($gameCharacterCreations.getInfo(1).Body.file == 'Body' (1))

try fixing both instances of that and see if that works
I tried this solution but it came up with the same error message as before. It also added a script call error.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,669
First Language
German
Primarily Uses
RMMV
You need to know the value you need to check in the string.
Most likely some of that (1)) behind it is part of the string - but most likely not everything.
So what do you want to check? Where die you get that code, because if you don't know this then most likely you didn't program it yourself.
 

Ahuramazda

Veteran
Veteran
Joined
Nov 9, 2012
Messages
262
Reaction score
127
First Language
English
Primarily Uses
RMMZ
I tried this solution but it came up with the same error message as before. It also added a script call error.
OK, yeah... I was running on being awake for over 24 hours when I posted that, and while I was maybe right about missing the other ', I should have placed it at the end of the string you were checking. So instead of 'Body' (1)), maybe 'Body (1)'), but that is still a guess without knowing more.

Are you using a plugin that assigns genders and just looking to make a call? If so, what plugin is it?
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
OK, yeah... I was running on being awake for over 24 hours when I posted that, and while I was maybe right about missing the other ', I should have placed it at the end of the string you were checking. So instead of 'Body' (1)), maybe 'Body (1)'), but that is still a guess without knowing more.

Are you using a plugin that assigns genders and just looking to make a call? If so, what plugin is it?
I am not using a plugin that assigns genders. This is making a call based on the character creation ex plugin.
http://sumrndm.site/character-creator-ex/

You need to know the value you need to check in the string.
Most likely some of that (1)) behind it is part of the string - but most likely not everything.
So what do you want to check? Where die you get that code, because if you don't know this then most likely you didn't program it yourself.
I found this piece of the code
$gameCharacterCreations.getInfo(1).Body.file == 'Body (1) somewhere on this site but cannot remember where.
Edit: I found it https://forums.rpgmakerweb.com/inde...des-character-creator-ex-plugin-f-a-qs.88746/
 
Last edited:

Ahuramazda

Veteran
Veteran
Joined
Nov 9, 2012
Messages
262
Reaction score
127
First Language
English
Primarily Uses
RMMZ
The code you are using is missing the final ' at the end of it, as I corrected myself earlier. The example you were looking for in the above link is the final question before the Resources section.

from that page:
Code:
$gameCharacterCreations.getInfo(ActorId).Body.file == 'Body (1)'
so yours should look like this:
Code:
if ($gameCharacterCreations.hasInfo(1)) {
    if ($gameCharacterCreations.getInfo(1).Body.file == 'Body (1)') {
        $gameSwitches.setValue(45, true);
    }
    else if ($gameCharacterCreations.getInfo(1).Body.file == 'Body (2)') {
        $gameSwitches.setValue(46, true);
    }
    else {
        $gameSwitches.setValue(45, false);
        $gameSwitches.setValue(46, false);
    }
}
Unless something else is wrong from what I read on that page, then it should be working with that.
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
The code you are using is missing the final ' at the end of it, as I corrected myself earlier. The example you were looking for in the above link is the final question before the Resources section.

from that page:
Code:
$gameCharacterCreations.getInfo(ActorId).Body.file == 'Body (1)'
so yours should look like this:
Code:
if ($gameCharacterCreations.hasInfo(1)) {
    if ($gameCharacterCreations.getInfo(1).Body.file == 'Body (1)') {
        $gameSwitches.setValue(45, true);
    }
    else if ($gameCharacterCreations.getInfo(1).Body.file == 'Body (2)') {
        $gameSwitches.setValue(46, true);
    }
    else {
        $gameSwitches.setValue(45, false);
        $gameSwitches.setValue(46, false);
    }
}
Unless something else is wrong from what I read on that page, then it should be working with that.
I had already done this correction but it does not work. I pasted this code in and got the same error message as before.
 

Ahuramazda

Veteran
Veteran
Joined
Nov 9, 2012
Messages
262
Reaction score
127
First Language
English
Primarily Uses
RMMZ
All I know is what I've read and set up, so I don't know how to help further. :/ so good luck to you and hopefully you can solve the problem.
 

Rhino

~Inactive~
Veteran
Joined
Feb 28, 2017
Messages
482
Reaction score
789
First Language
English
Primarily Uses
RMMV
I tested Ahuramazda's code in a base CCEX project (basically, just the plugins required for it to run,) and it worked as intended, so I think your problem is elsewhere.

Try turning off your plugins systematically to see if any of them are causing the conflict.
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
I tested Ahuramazda's code in a base CCEX project (basically, just the plugins required for it to run,) and it worked as intended, so I think your problem is elsewhere.

Try turning off your plugins systematically to see if any of them are causing the conflict.
Which plugins are required for this script to run? I had to disable some because they were clashing with other plugins I already had installed.
 

Rhino

~Inactive~
Veteran
Joined
Feb 28, 2017
Messages
482
Reaction score
789
First Language
English
Primarily Uses
RMMV
It needs SumRndmDde's SuperToolsEngine and CharacterCreatorEX to run. :cutesmile:

Try disabling every other plugin and testing the event. Assuming it works (which it should, unless something has gone wrong with the event too), you'll need to go through your other plugins turning them on/off until you cause the error to appear again, and then you'll know where the conflict is. It may be caused by a single plugin, or because of a clash in a group of them.

Once you know that, you can decide how important the plugins are, and whether you'd be happy to just cut back on some features, or try posting a request with a demo project of the error to see if someone can help patch the problem.
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
It seems to have a problem with every one of Yanfly's plugin's.
 

Rhino

~Inactive~
Veteran
Joined
Feb 28, 2017
Messages
482
Reaction score
789
First Language
English
Primarily Uses
RMMV
I think that's unlikely, given the huge range of content that plugins cover. I have another project file which has a lot of Yanfly's core plugins, and the script still works fine. Though, I appreciate it can be hard to narrow down which plugins are involved when so many of them have dependency on one another.

From the original screenshot you posted, one might guess it was YEP_X_ItemRequirements causing the issue, but having tested that, it seems ok. (Sometimes I've noticed error messages just show the first thing that's flagged up as wrong, although it's not specially the cause of the issue. It makes debugging a little bit more troublesome, you might just have to follow instinct instead :hswt:)

Other possible explanations are issues between different versions. I recommend checking out YEP Auto Update and SRD Plugin Updator to keep your plugins up-to-date. Also, what version of MV is your project running?

Another possibility is that your plugins are in the wrong order. Yanfly recommends arranging his plugins as shown on this page, and STE would ideally be at the top. It might help if you share a screenshot of your plugin manager.

You can also PM me a copy of your project if you want. I promise not to repost it anywhere, although I can't promise that I'll find the cause of the problem/solution! I just thought it might be a bit quicker than trying to talk through the list of possibilities, especially when the console errors are being unhelpful(!)
 

Midnight Kitty

Midnight
Veteran
Joined
Jun 18, 2013
Messages
129
Reaction score
14
First Language
English
Primarily Uses
RMMV
I had also tried disabling YEP_X_ItemRequirements to find the next YEP Plugin above it presenting the same issue. It continued along Yanfly's plugins such as YEP_CommonEventMenu, YEP_HitAccuracy then also noting the core engine.
My project is currently running MV 1.6.1 I should have the plugins in the order described and STE is at the top.

Ok I will PM you a version of it.
 

Attachments

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,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top