So close

Discussion in 'Javascript/Plugin Support' started by Indsh, Oct 27, 2015.

  1. Indsh

    Indsh Veteran Veteran

    Messages:
    217
    Likes Received:
    65
    Location:
    Bristol
    First Language:
    English
    Primarily Uses:
    N/A
    Hello,

    I am making a game that needs events to be deleated by there map id. I feel I am near there but this code is coming up with the error "Unexspected numbers". Anybody no whats going wroung, once I get this sortd my whole system should work

    if ($gameMap.event(this._eventId).x === $game_variables [3] && $gameMap.event(this._eventId).y === $game_variables [4]) {SelfSwitch 20 true;}

    Any help appricated. V
     
    #1
  2. kiriseo

    kiriseo Veteran Veteran

    Messages:
    229
    Likes Received:
    74
    First Language:
    German
    I've just startet learning JavaScript, so I don't know everything about it.

    But is this code exactly the same you're using? Or did you mistyped some parts?

    I'm asking because to me it seems a little odd when I look at

    {SelfSwitch 20 true;}

    Shouldn't there be an equal sign?
     
    #2
  3. altorn

    altorn Veteran Veteran

    Messages:
    53
    Likes Received:
    12
    Location:
    Toronto, Canada
    First Language:
    English
    if ($gameMap.event(this._eventId).x === $gameVariables.value(3) && $gameMap.event(this._eventId).y === $gameVariables.value(4))


    {


    $gameSelfSwitches.setValue(20, true);


    }
     
    Last edited by a moderator: Oct 27, 2015
    #3
  4. Shaz

    Shaz Veteran Veteran

    Messages:
    37,923
    Likes Received:
    11,586
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Are you trying to disable an event on the current map, or events on other maps? 

    Changing a self switch requires that you pass in a map id, an event id, and the self switch id (A, B, C, D), as well as the true/false value to denote on/off.

    var key = [mapId, eventID, selfswitchID];$gameSelfSwitches.setValue(key, true);

    where mapID and eventID are numbers (no leading zeros), and selfswitchID is 'A' to 'D'.
     
    #4
  5. Indsh

    Indsh Veteran Veteran

    Messages:
    217
    Likes Received:
    65
    Location:
    Bristol
    First Language:
    English
    Primarily Uses:
    N/A
    I have the Self Switch Plugin for MV, where the call is (SelfSwitch [n] true);

    I will try what you have all suggested when I get to the right computer thank you very much. V
     
    #5
  6. kiriseo

    kiriseo Veteran Veteran

    Messages:
    229
    Likes Received:
    74
    First Language:
    German
    If that is the syntax, then you're missing the brackets around the number.

    Like this:

    {SelfSwitch[20] true;}

    I think that's why the error message says something about "unexpected numbers".
     
    Last edited by a moderator: Oct 28, 2015
    #6

Share This Page