[Solved by Poryg] Help Request : Image Path From Variable

Status
Not open for further replies.

Monkeynugget

Veteran
Veteran
Joined
Sep 12, 2016
Messages
44
Reaction score
37
First Language
English
Primarily Uses
HI

Im really, really new at javascript and cannot find this answer anywhere :kaodes:

I wanted to make an on screen avatar but didn't want a billion unfoldered images



I found a concept and tried to make the below plugin on the left which works :kaoblush:but only for a text file path :kaosigh:

I'd like the file path to be derived from game variables, even if its just the picture number but it just wont have it :kaocry:




Right now - ImageSwitcher(Picture[ID], "TEXT/TEXT/TEXT"); - works fine

But id like to - ImageSwitcher(Picture[ID], "TEXT/TEXT/"$gameVariables.Value[1]); - But it wont return the image:kaocry:



Is anyone able to see where im going wrong??

Ideally end state would be ActorName/Text/variable1 but id just settle if anyone can tell me where im meesing up just on the first step


Many thanks to anyone able to help me
 
Last edited:

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
You need to add the strings together.
"img/characters/" + $gameVariables.value(1) + ".png";
 

Monkeynugget

Veteran
Veteran
Joined
Sep 12, 2016
Messages
44
Reaction score
37
First Language
English
Primarily Uses
You need to add the strings together.
"img/characters/" + $gameVariables.value(1) + ".png";
Hi thanks for helping :kaothx:

I tried your solution but got the below error

I tried the .png bit aswell and ended with same error but with ".png.png" at the end so I took that bit out

Sorry if im being dense:kaocry:

error.PNG
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
Do not use \ in the filepath. Use / instead. EDIT: Well, looks like it's not your fault, but the fault of the plugin you're using.
Also, there' a difference between
$gameVariables.value(2), the correct form, and
$gameVariables.value[2], which you have in the script.
 

Monkeynugget

Veteran
Veteran
Joined
Sep 12, 2016
Messages
44
Reaction score
37
First Language
English
Primarily Uses
Hi thanks for helping :kaothx:

I tried your solution but got the below error

I tried the .png bit aswell and ended with same error but with ".png.png" at the end so I took that bit out

Sorry if im being dense:kaocry:

View attachment 108766

Huzzah!!!!:kaojoy:

Solved it, then I saw your reply :kaoswt:
Using wrong bracket
stupid bracket.PNG


Thankyou very much

:kaoluv:
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,842
Reaction score
5,225
First Language
Dutch
Primarily Uses
RMXP

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

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,045
Members
137,569
Latest member
Shtelsky
Top