How to use HIGHLIGHT_IMAGE
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
How to use HIGHLIGHT_IMAGE
I can't get HIGHLIGHT_IMAGE to work.
In my scenario-in-progress, I place a boat on the map at some point, and I want it to flash to draw the player's attention to it. The x,y coordinates are the location of the boat, I'm sure, but the macro requires two other values.
What variable goes into image?
What variable goes into the last spot? Do I put a 0 if there is no item on that hex? If there is an item, how would I enter it for BACKGROUND_VALUE?
If {IMAGE} is a macro within a macro, where is the code located? I checked the macro folder and examined the cfg files that seemed possible locations, but didn't find it.
Here is the code for HIGHLIGHT_IMAGE. Thanks.
In my scenario-in-progress, I place a boat on the map at some point, and I want it to flash to draw the player's attention to it. The x,y coordinates are the location of the boat, I'm sure, but the macro requires two other values.
What variable goes into image?
What variable goes into the last spot? Do I put a 0 if there is no item on that hex? If there is an item, how would I enter it for BACKGROUND_VALUE?
If {IMAGE} is a macro within a macro, where is the code located? I checked the macro folder and examined the cfg files that seemed possible locations, but didn't find it.
Here is the code for HIGHLIGHT_IMAGE. Thanks.
Code: Select all
#define HIGHLIGHT_IMAGE X Y IMAGE BACKGROUND_VALUE
# Scrolls to the given location, blinks the given image in and out a few
# times, and then leaves the image in place. Use this to pinpoint an
# important location to the player. If there's an existing [item] on the
# location, specify it as the BACKGROUND_VALUE or else it'll get lost
# during the blinking.
[scroll_to]
x,y={X},{Y}
check_fogged=no
[/scroll_to]
[repeat]
times=3
[do]
[item]
x,y={X},{Y}
halo={IMAGE}
[/item]
[redraw][/redraw]
[delay]
time=300
[/delay]
[remove_item]
x,y={X},{Y}
[/remove_item]
[item]
x,y={X},{Y}
image={BACKGROUND_VALUE}
[/item]
[redraw][/redraw]
[delay]
time=300
[/delay]
[/do]
[/repeat]
[item]
x,y={X},{Y}
image={IMAGE}
[/item]
[redraw][/redraw]
#enddef
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
Re: How to use HIGHLIGHT_IMAGE
Relevant wiki page: https://wiki.wesnoth.org/PreprocessorRef
Relevant example, from the first scenario of HttT:
1 and 1 are the x and y coordinates, of course, and "scenery/signpost.png" is the image that it highlights. Then the () seems to be an empty argument, to set BACKGROUND_VALUE to nothing.
{X} in the function substitutes in the value that you put in place of X when you call the function, and {IMAGE} represents whatever you write in the IMAGE slot, and so on. So if you replace that line in the HttT scenario with this block of code (made by taking the body of the macro and substituting in all the arguments), it should do exactly the same thing as that macro call does.
I hope this helps!
Relevant example, from the first scenario of HttT:
Code: Select all
{HIGHLIGHT_IMAGE 1 1 scenery/signpost.png ()}
{X} in the function substitutes in the value that you put in place of X when you call the function, and {IMAGE} represents whatever you write in the IMAGE slot, and so on. So if you replace that line in the HttT scenario with this block of code (made by taking the body of the macro and substituting in all the arguments), it should do exactly the same thing as that macro call does.
Code: Select all
[scroll_to]
x,y=1,1
check_fogged=no
[/scroll_to]
[repeat]
times=3
[do]
[item]
x,y=1,1
halo=scenery/signpost.png
[/item]
[redraw][/redraw]
[delay]
time=300
[/delay]
[remove_item]
x,y=1,1
[/remove_item]
[item]
x,y=1,1
image=()
[/item]
[redraw][/redraw]
[delay]
time=300
[/delay]
[/do]
[/repeat]
[item]
x,y=1,1
image=scenery/signpost.png
[/item]
[redraw][/redraw]
Re: How to use HIGHLIGHT_IMAGE
It worked! Thanks.
It's not as bright as I expected. Moving the boat one hex might be more noticeable. Hm.
HttT was a great campaign. I barely won that amazing last scenario; it took me a few tries. I don't think it's a spoiler to state that the ultimate death animation was brilliant. I forgot that the signpost flashed in the first scenario of HttT. I should start making notes when I play a campaign, so I'll know where to look for code examples.
It's not as bright as I expected. Moving the boat one hex might be more noticeable. Hm.
HttT was a great campaign. I barely won that amazing last scenario; it took me a few tries. I don't think it's a spoiler to state that the ultimate death animation was brilliant. I forgot that the signpost flashed in the first scenario of HttT. I should start making notes when I play a campaign, so I'll know where to look for code examples.
Author of:
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.
DIY Campaign, Confederacy of Swamp Creatures: Big Battle 1, Confederacy of Swamp Creatures: Big Battle 2, Frogfolk Delivery Service, The Pool of Ek.