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

HI

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

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 😊but only for a text file path 😔

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 😢




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😢



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
You need to add the strings together.
"img/characters/" + $gameVariables.value(1) + ".png";
You need to add the strings together.
"img/characters/" + $gameVariables.value(1) + ".png";

Hi thanks for helping 🙏

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😢

error.PNG
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.
Hi thanks for helping 🙏

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😢

View attachment 108766


Huzzah!!!!😂

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



Thankyou very much

😍

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.

Original thread: https://forums.rpgmakerweb.com/threads/solved-by-poryg-help-request-image-path-from-variable.105207/