Sugarcube make a random image appear

841 views Asked by At

I'm actually trying to do a random image picker to make the game more real.

here is the actual code

<<set $randomimage = random(5)>>

[img["home" + $randomimage.jpg]]

I'm only an amateur but it seemed logic to do it that way for me but it appears that in chrome my variable $randomimage is undefined. Getting this error:

<img src="homeundefined">
1

There are 1 answers

0
volen On BEST ANSWER

Here is the solution:

<<set $randomimage = random(5)>>

[img["home" + $randomimage + ".jpg"]]