ScriptSpot

Forum topic · General Scripting

apply image on mapbutton

By SugaR · 2013-10-14

Description

Hi Guys

I try to find how can I show the selected map from the material/map browser on the mapbutton (and not the name).

I know I need a filename to put image on the mapbutton, but the material/map browser don't return it, just something like this: "Map #1: checker"

So how can I use this to get the filename ?

Thanks in advance for any help :)

Comments (4)

SugaR · 2013-10-14

Yes, but in this case I add some parameters to renderMap, that's why I used a variable :)

SugaR · 2013-10-14

Thanks barigazy, you help me a lot in this past few days.

Just a thing, you don't need to apply the map on a slot. This do the trick:


on mapbutton picked sel do
(
 local selRender = renderMap sel
 mapbutton.images = #(selRender, undefined,1,1,1,1,1)
)

I prefer to avoid use a medit slot when it's not necessary.

But still, a big thanks :)

barigazy · 2013-10-14

You are good when you need to solve the problem with little help.
Sometime I need to wrote bunch of snippets someone to understand :)
Anyway if you don't want to use "selRender" variable then you can do it in one line

on mapbutton picked sel do
(
mapbutton.images = #((renderMap sel), undefined,1,1,1,1,1)
)