Syntax Error

● ARCHIVED · READ-ONLY
Started by iasagi 15 posts View original ↗
  1. having an issue when making a doppelganger script, I was following a youtube video and it told me to do this.


    $dataEnemies[11].params[0]=$gameActors.actor($gameVariables.value(5)) .mhp

    $dataEnemies[11].params[1]=$gameActors.actor($gameVariables.value(5)) .mmp

    $dataEnemies[11].params[2]=$gameActors.actor($gameVariables.value(5)) .atk

    $dataEnemies[11].params[3]=$gameActors.actor($gameVariables.value(5)) .def

    $dataEnemies[11].params[4]=$gameActors.actor($gameVariables.value(5)) .mat

    $dataEnemies[11].params[5]=$gameActors.actor($gameVariables.value(5)) .mdef

    $dataEnemies[11].params[6]=$gameActors.actor($gameVariables.value(5)) .agi

    $dataEnemies[11].params[7]=$gameActors.actor($gameVariables.value(5)) .luk

    $dataEnemies[11].=$gameActors.actor($gameVariables.value(5)) ._name

    $dataEnemies[11].battlerName="Actor2_1"

    but now i get this error error for forums.png
    Any help on this would be nice, that or giving me a Better way to make a Doppelganger, pretty much wanting an enemy that doubles a selected Actors current stats. if possible, i looked for a Plugin to accomplish this but couldn't find anything,
  2. [move]Learning JavaScript[/move]
  3. You have a . and = side by side on the line for making it copy the name, try fixing that and see what happens?
  4. upload_2018-7-18_9-44-15.png
    :) You can't do it. $dataEnemies[11].params[8] in place of $dataEnemies[11].
    (And the ; at the end of each line) ;)

    Cheer up!
  5. @iasagi
    It has been proven again and again that video tutorials are usually a very bad idea to learn or understand anything that has to do with programming. The cases where people got errors because they were unable to see the differences between () and [] or failed to see/count the number of spaces due to low resolution and fast recording of the video is legendary, and that doesn't even count such problems that videos often skip over the basics, requiring an existing understanding of programming to be even usable.

    The posters above already pointed some of your typing errors - but there are others if the lines you posted are directly copied.
    For example you have spaces between the ) and the . at the end of your lines, like ue(5)) .mhp
    That is also a mistake although sometimes an interpreter can overlook wrong spaces.

    For the future, try to find text tutorials where you can copy the code if at all possible, and keep in mind that for a programmer, "syntax error" basically means that you have a typo or a wrong word in your code that the computer doesn't understand.
    Unfortunately the computer is bad at reporting errors, because it reports errors at the place and time when it realises something is wrong - which is not automatically the same place as the error really is. You can compare it with a box of parts where the first part is missing, but the robot checks to the end of the box before reporting "there is a part missing" and doesn't tell you which part, where the human would have been able to tell "the first part is missing" upon opening the box.
  6. Didn't know if replying to multiple counted as Double posting or not so I figured id just put it all in one. Here is the picture from the video Script command for forum.png
    I've also spaced out the = on each line so nothing is I found the problem ( i uh in my sleepy state forgot to add the " Name " between the .= my apologies I overlooked something so simple shameful I've watched loads of videos on tutorials for basic and advance things in MV but this is the first I've overlooked a simple mistake. ill post my updated code but it produced a new error.


    $dataEnemies[11].params[0] = $gameActors.actor($gameVariables.value(5)).mhp

    $dataEnemies[11].params[1] = $gameActors.actor($gameVariables.value(5)).mmp

    $dataEnemies[11].params[2] = $gameActors.actor($gameVariables.value(5)).atk

    $dataEnemies[11].params[3] = $gameActors.actor($gameVariables.value(5)).def

    $dataEnemies[11].params[4] = $gameActors.actor($gameVariables.value(5)).mat

    $dataEnemies[11].params[5] = $gameActors.actor($gameVariables.value(5)).mdef

    $dataEnemies[11].params[6] = $gameActors.actor($gameVariables.value(5)).agi

    $dataEnemies[11].params[7] = $gameActors.actor($gameVariables.value(5)).luk

    $dataEnemies[11].name = $gameActors.actor($gameVariables.value(5))._name

    $dataEnemies[11].battlerName="Actor2_1"

    Here is what I've done, then ill post the new error,
    1) fixed the .= problem with the name line.
    2) Added the ; to the end of it but it didn't do anything so I took it off
    3) @Andar you said that the . at the end was a mistake, ex .mhp I tried taking the . out but it came up with another issue without the periods.png

    with the Periods at the end, i get this error newerror.png

    I'll keep looking on my own as well, Sorry for my noobness i'm well aware I'm not ready for coding but I couldn't find a way to do this with a Plugin or eventing so I'm only left with one option since I can't pay someone to make a plugin for me lol I appreciate all the help, sorry if these issues are Obvious, I'm starting my Coding course next week granted it's on HTML5 Then Javascript but it's more than I have now, thanks for helping in the meantime.
  7. I didn't say that the dot was a mistake, I said that the space between the ) and the dot is a mistake.
    As for the problem you now have - when and where do you try to execute that code?
    How do you set the value of variable 5? what is it and what are the actors in your database?
  8. How do you set the value of variable 5?

    Bingo.

    If variable #5 isn't set to anything, it has a default value of zero.
    Actor #0 is null.
    Null doesn't have a property "mhp", thus the error message.

    You can check on the values of the variables during a playtest by pressing F9. When you encounter errors, you can see more information in the Console by pressing F8.
  9. Ah, my apologies, I misread it >< 5 As the actor, I decided to change the actor to 1 see if it was something with that actor but nothing, Still getting the type error, maybe since you guys know what you are doing ill post my Logs, sorry its taking up so much time didn't think it would lead to other issues, i hardly have any issues in MV =>,..,<=f8 log.png
  10. Every time you change the code, please include a new screenshot of your event so we can follow along (and if you're posting code, please use the code tags so it's readable).

    Also, I think you may have misunderstood Andar and my meaning:

    Code:
    $dataEnemies[11].params[0] = $gameActors.actor($gameVariables.value(5)).mhp
    • If you never set Variable #5, then the value of the variable is zero.
    If so, then the formula is evaluated like this:
    Code:
    $dataEnemies[11].params[0] = $gameActors.actor(0).mhp
    • There is no actor #0, actors start at #1, so you get an error
    It's why I suggested to look at the variables by pressing F9 in a playtest. Please include a screenshot of the F9 menu in addition to your latest event code.
  11. Alright, my bad didn't know you could do that with the code...

    Code:
     $dataEnemies[11].params[0] = $gameActors.actor($gameVariables.value(1)) .MHp
    $dataEnemies[11].params[1] = $gameActors.actor($gameVariables.value(1)) .MMp
    $dataEnemies[11].params[2] = $gameActors.actor($gameVariables.value(1)) .Atk
    $dataEnemies[11].params[3] = $gameActors.actor($gameVariables.value(1)) .Def
    $dataEnemies[11].params[4] = $gameActors.actor($gameVariables.value(1)) .Mat
    $dataEnemies[11].params[5] = $gameActors.actor($gameVariables.value(1)) .MDef
    $dataEnemies[11].params[6] = $gameActors.actor($gameVariables.value(1)) .Agi
    $dataEnemies[11].params[7] = $gameActors.actor($gameVariables.value(1)) .Lck
    $dataEnemies[11].name = $gameActors.actor($gameVariables.value(1)) ._name
    $dataEnemies[11].battlerName="Actor2_1"

    hope I did that right. lol guess we will find out
    errr F9 isn't doing anything when the fight starts. and outside the fight it pulls up my switches, but the event isn't activated by a switch. ill add some additional pictures that may be of use.

    CommoneventIasagiFight.png Params.png actors.png beforeerror.png after error.png hopefully, some of that information helps get this solved so you guys can go back to your business, didn't think it would take this long. bright side its a learning experience.
  12. Now you changed the code to use variable #1 instead of variable#5, but you still have not shown us where you set the value for that variable.
    Just to be clear: you have NOT changed the code to actor #1, you have changed it to the actor whose ID is stored in variable #1, which is still zero if you didn't set that variable somewhere.

    And as I said before, please remove the spaces between the ) and the dots from your code.
    This is wrong:
    Code:
    $dataEnemies[11].params[0] = $gameActors.actor($gameVariables.value(1)) .MHp
    This is correct:
    Code:
    $dataEnemies[11].params[0] = $gameActors.actor($gameVariables.value(1)).MHp
    .

    And the part we're talking about in the past several posts is
    $gameVariables.value(1)

    You're using variable #1 now (instead of variable #5 in the first code posts), but we don't see any line that tells the variable which actor you want to copy.
  13. Hmm so like this ? updatescript.png This didn't change the error at all newerror.png i didn't change anything else so all of the pictures are still usable for information.

    I also tried it with the ; but nothing still same error but ill add the picture of the code anyway incase I managed to mess up something.withthe;.png
  14. The attributes need to be: .mhp .mmp .atk .def .mdf .mat .mdf .agi .luk
    exactly like that... no capital letters

    And in the pic above you're setting variable 5 to the ID of the 1st party member, so make it: $gameVariables.value(5)

    Lastly, the ";" at the end of each line essentially just tells the script to go to the next line or consider anything past that point as a new line, so its *not* needed for this to work... but it doesn't hurt to use.

    I use something kinda like this for the Mimics in my game, so the idea does work :)
  15. You set variable 5 to the ID of actor 1 BUT on the script calls you used $gameVariables.value(1) which means your script calls are using Variable 1, not variable 5. So ofc it still wont work

    and as the person above me said, the parameters are always .atk, .mhp and so on when you call them via script, dont use the terms you set on the database because those only for when the game is writing the values

    for example: Even if you rename the Max HP database term into RAWR, the script call for it is still .mhp