Alador

Captain Cute
Veteran
Joined
Apr 16, 2020
Messages
205
Reaction score
254
First Language
English
Primarily Uses
RMMV
JavaScript:
CopyTiles 1 1 'layout' $gameVariables.value(6) 1 ($gameVariables.value(6) += 15) 11
returns the error "Invalid or unexpected token." How can I get this to use the incremented variable without returning an error message?
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
848
Reaction score
711
First Language
English
Primarily Uses
RMMV
JavaScript:
CopyTiles 1 1 'layout' $gameVariables.value(6) 1 ($gameVariables.value(6) += 15) 11
returns the error "Invalid or unexpected token." How can I get this to use the incremented variable without returning an error message?
use a script call instead of a plugin command - plugin commands don't evaluate inputs (so it is trying to read the text string '$gameVariables.value(6)' instead of the value of game variable 6.)

Code:
changeTile(1,1,'layout', $gameVariables.value(6), 1, ($gameVariables.value(6) += 15), 11)
should probably work
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,749
Reaction score
15,314
First Language
English
Primarily Uses
RMMV
plugin commands don't evaluate inputs

this one does, but

($gameVariables.value(6) += 15)
this isn't valid. The plugin uses spaces to delimit terms, not parentheses. And what is the += for? That's an assignment operator and shouldn't be used here at all. If you want to increment the value, do it either before or after the plugin command. If you just want that value plus 15, get rid of the =.


All arguments can be script commands that will be evaluated - make sure there are no spaces anywhere within the individual arguments/script commands.

Change it to
Code:
$gameVariables.value(6)+15
(with no spaces)
 
Last edited:

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
848
Reaction score
711
First Language
English
Primarily Uses
RMMV
I stand corrected!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,980
Reaction score
8,620
First Language
German
Primarily Uses
RMMV
@patternBlue I doubt that would work because that editor uses a different tileset structure
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
1,024
Reaction score
651
First Language
Polish
Primarily Uses
RMMV
Hey @Shaz, is there an option to copy tile depending on player posiotion? For example you can draw a road under player while walking.
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,980
Reaction score
8,620
First Language
German
Primarily Uses
RMMV
@fizzly you pinged the wrong person...

@Shaz is the programmer of this plugin...
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
2,272
Reaction score
1,228
First Language
English
Primarily Uses
RMMV
is there an option to copy tile depending on player posiotion? For example you can draw a road under player while walking.
You'd have a parallel process on the map that is checking for the player to have moved - do a Google for events for footstep sounds or walking, you'll get many examples you can copy.

Then, inside a conditional branch for the player position having changed, you'd make the appropriate plugin command for this to change the tile image.

Note that drawing a road is kind of complicated, because they're typically an autotile that looks different depending on the tiles around it. This plugin won't handle that, because you're choosing a specific square from the tileset to place on the map, so if you want an autotile road to look right, you're going to have a pretty complex set of nested conditionals to see what's around it and place the appropriate road image.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,749
Reaction score
15,314
First Language
English
Primarily Uses
RMMV
What @ATT_Turan said.

The coordinates are easy enough - the plugin command will take things like $gamePlayer.x and $gamePlayer.y as arguments. It's telling it what tile to use that's going to be complicated.
 
Joined
Sep 28, 2021
Messages
3
Reaction score
1
First Language
French
Primarily Uses
RMMV
Hi ! What a amazing script !

ChangeTile work perfectly ! But i just can't make CopyTiles work i just dont understand what im doing wrong :/

I want to copy 3 tile from the map 005 to the map 004

I keep getting ''build is not defined''

not defined.png
test.png

Code:
<load:[{"name":"build","map":5}]>
test2.png
 
Last edited:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,980
Reaction score
8,620
First Language
German
Primarily Uses
RMMV
I keep getting ''build is not defined''
that is because you didn't give a string with the name build but tried to use build as a variable, and that of course is not defined.
look at Shaz' examples in the first post to see what your command is missing - namely the string defining '
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,749
Reaction score
15,314
First Language
English
Primarily Uses
RMMV
Good pickup!

In hindsight, I sometimes wish I'd not used names at all for maps, and just made it use map ids.
 

Latest Threads

Latest Profile Posts

Redesigning characters after such a long time feels great. Makes me excited to work on an old game again.
Phone menu to replace main menu WIP:
It's been that long since I wrote a plugin, it took me 4 attempts to realize it's != rather than #. In a 40-line plugin, 20 of those lines being documentation!
Disk Check Plugin - Running on Linux:
RMMV-Game-Mint.png
workin on some graphics for my game. was originally planning on doing a cartoony style for the town but I might stick with this instead

Forum statistics

Threads
116,085
Messages
1,095,617
Members
151,459
Latest member
ingridabiyos
Top