Embed Pictures

Today I have an easy question… But I am no progammer, so… :slight_smile:
What type Variable to use for “Id”? How to define it?

(I later found out, that this example wouldn’t work anyway.
Instead, please look at the example in my next post!)

(old example:)

(define resource Id)
	media/cat2.jpg; A picture of a happy cat.

#cat
(name *) ...
.
.
.

(instead of [pet #cat])
		Brrrrrrrr....
		(if) (interpreter can embed *) (then)
		(div @center) (embed resource Id)
		(endif)

Sorry… what I wanted to use instead was grammer and perform to define a new action…
(Still the question, what type of Variable to use instead of “Id” remains the same)

(new example:)

(define resource Id)
	media/cat2.jpg; A picture of a happy cat.

(grammar [pet [single]] for [pet $])

(perform [pet (cat $)])
	Brrrrrrrr....
	(if) (interpreter can embed Id) (then)
	(div @center) (embed resource Id)
	(endif)

(perform [pet $])
	Why would you pet that?

#cat
(name *) ...
.
.
(cat *)

If found a way. It was even more easy than expected:

I declared a global variable beforehand:

(global variable (cat_pic2 #cat_pic2))

and replaced Id with #cat_pic2 in the example above

1 Like