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,271
Reaction score
8,723
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,271
Reaction score
8,723
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,271
Reaction score
8,723
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,271
Reaction score
8,723
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,271
Reaction score
8,723
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,509
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

Surprising nobody, it turns out "next Friday" for the next Jump into Javascript has become "possibly Sunday if you're lucky" XD
Folks, if anyone sends you a message inviting you to add their API to your game, please report them. We don't want people spamming our members asking them to add stuff to their games for their own (or others') benefit. We've updated the forum rules to confirm this.
I'm listening to iiluminaughtii talking about the secrets behind shady businesses and scams. Meanwhile I'm writing a fanfic about Sephiroth from FF7, one specifically for my stepmom. I'll get to give it to her, too, because my boss said I could take the holidays off! Dec. 22-27 I will be in Orlando, and maybe Fort Myers too, visiting my dad and stepmom!
Of course, I bought a handful of games on the Steam Black Friday sale. Will I try them? Will I complete any? Who knows...
I don't really have any neat updates today about how I screwed up programming... But if you want to observe the intensenes of me programming, then you can check out my stream :)

Forum statistics

Threads
117,013
Messages
1,103,814
Members
152,911
Latest member
WakeNBake
Top