Show item icon instead number?

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
262
Reaction score
40
First Language
brazil
Primarily Uses
Hello everyone, I used command: $dataItems[$gameVariables.value(237)].iconIndex in order to show icon image, but showed icon number.
Is there anyway to show icon image?
 

AphoticAmaranth

An Ordinary Human
Veteran
Joined
Mar 29, 2020
Messages
86
Reaction score
77
First Language
English
Primarily Uses
RMMV
Are you trying to show icon #237, or an icon with a variable value?

Code:
\i[237]

will show icon 237

Code:
\i[$gameVariables.value(237)]

should show the icon which matches variable 237, if I'm not mistaken.
 

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
262
Reaction score
40
First Language
brazil
Primarily Uses
$dataItems\i[$gameVariables.value(237)].iconIndex
I used this, but show only number.
Thanks for answear
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,273
Reaction score
8,727
First Language
German
Primarily Uses
RMMV
WHERE do you want to show the icon?
for any text field like show text the text code given two posts above is correct.

your alternative from the post above will never work because it mixes text code and javascript code.

And IconIndex is ALWAYS the number of the icon - that is what index means. It is never the icon itself, which is drawn by functions referencing the index.
 

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
262
Reaction score
40
First Language
brazil
Primarily Uses
WHERE do you want to show the icon?
for any text field like show text the text code given two posts above is correct.

your alternative from the post above will never work because it mixes text code and javascript code.

And IconIndex is ALWAYS the number of the icon - that is what index means. It is never the icon itself, which is drawn by functions referencing the index.
Any text box
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,273
Reaction score
8,727
First Language
German
Primarily Uses
RMMV
then your answer was given already

\i[n]
will show the icon with the number icon index n inside the text message.

\i[v[id]]
will show the icon whose icon index is stored in variable with ID in the text message.

If that is not enough, then you need to explain to us which icon exactly you want to display, and where you stored it's iconindex (or where you want to get the index from)
 

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
262
Reaction score
40
First Language
brazil
Primarily Uses
then your answer was given already

\i[n]
will show the icon with the number icon index n inside the text message.

\i[v[id]]
will show the icon whose icon index is stored in variable with ID in the text message.

If that is not enough, then you need to explain to us which icon exactly you want to display, and where you stored it's iconindex (or where you want to get the index from)
1635096199946.png
Dont worked :(
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,273
Reaction score
8,727
First Language
German
Primarily Uses
RMMV
I forgot the second slash
\I[\V[id]]
will work
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,273
Reaction score
8,727
First Language
German
Primarily Uses
RMMV
it does - and your screenshot proves it.

The first icon in the iconset is always invisible - it needs to be for the battlescreen to handle states correctly.
so I'm guessing you didn't store any number in the variable and the textcode was correctly converted to the invisible icon #0, because otherwise you would read the text of the wrong text code there
 

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
262
Reaction score
40
First Language
brazil
Primarily Uses
it does - and your screenshot proves it.

The first icon in the iconset is always invisible - it needs to be for the battlescreen to handle states correctly.
so I'm guessing you didn't store any number in the variable and the textcode was correctly converted to the invisible icon #0, because otherwise you would read the text of the wrong text code there
1635097663399.png
 

Kristina

Veteran
Veteran
Joined
Jun 22, 2019
Messages
254
Reaction score
242
First Language
Danish
Primarily Uses
RMMV
The icon with the ID number 1 seems to be invisible, which is why you can't see it.
 

Kristina

Veteran
Veteran
Joined
Jun 22, 2019
Messages
254
Reaction score
242
First Language
Danish
Primarily Uses
RMMV
Go to your icon index and find the icon you need. At the bottom of that window there will be a number, which is the ID of the icon. Write that ID to show the icon.
 

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
262
Reaction score
40
First Language
brazil
Primarily Uses
Go to your icon index and find the icon you need. At the bottom of that window there will be a number, which is the ID of the icon. Write that ID to show the icon.
But I want to show the icon according with variable.
The number of icon I know.
 

Kristina

Veteran
Veteran
Joined
Jun 22, 2019
Messages
254
Reaction score
242
First Language
Danish
Primarily Uses
RMMV
I get that but either there's no icon matching with the ID or you have done something wrong with the variable. Try to look at your variable and see if you made a mistake somewhere.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,273
Reaction score
8,727
First Language
German
Primarily Uses
RMMV
But I want to show the icon according with variable.
The number of icon I know.
then you need to store that number into the variable before the show text.
when I tested my code (and yes, for the second version I tested it to make sure), the event was
1) control variable var1=5 to store number five into the variable
2) show text \I[\V[var1]] to show icon number 5 which worked.

EDIT:
I found your error:
$dataItems\i[$gameVariables.value(237)].iconIndex
This line is absolute nonsense that will always result in zero, which is why the invisible icon was displayed.

Once again, please tell us what icon you want to display so that we can tell you how to enter it instead of the nonsense you used in your screenshot.
 

Decinbr

Veteran
Veteran
Joined
Mar 20, 2015
Messages
262
Reaction score
40
First Language
brazil
Primarily Uses
Worked now!
I removed \i before $gamevariables.
Thank so much man!
$dataItems[$gameVariables.value(237)].iconIndex
\I[\V[1]]
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
44,094
Reaction score
15,515
First Language
English
Primarily Uses
RMMV
None of the things you did were what people suggested. You always changed them in some way compared to how they were posted. Even your last post isn't right (so if it works, what you posted is not exactly what you did).

\i[\v[237]]

should be all you need.
 

Latest Threads

Latest Posts

Latest Profile Posts

All new MZ Weather & Title updates are also RETRO'able for MV! Updated RETRO project will be released on same day I'll release updated MZ demo -project!

retro.png
Just lost about half a day's worth of work because rpg maker crashed during playtesting and corrupted my file :kaolivid:
Boku.gif
advanced_puzzling.PNG
Having a lot of fun making different poses for my character sets! Open to suggestions/critique!

CSKttqh.png

AABS laser beams features:
1,Shoot penetrating laser beams for player's normal attack
2,Beam's width/damage/comsumes/loot can be controlled by events/variables with great flexibility
3,Beam can rebound to walls or certain regionID
4,Can play SE when shooting beams
5,Beam's images can be solid images or animated ones.

Forum statistics

Threads
117,018
Messages
1,103,883
Members
152,923
Latest member
mistikal
Top