Ok, I know i can make a button pic change when the mouse goes over a hotspot, (and change back again by using another hotspot around it). and i can make a button pic change when the player stands on a region... but is there a way to make a button pic change when the mouse passes over a character?
thanks
Consult the manual on GetLocationType type functions...
hmm, usefull, but what if the character was moving/moved to a different location?
check in repeadetly_execute if GetLocationType is nothing or GUI...
ah i see, i was thinking it would only do it when the player was over the coordinates stated, but it relies on where u put the mouse.
thanks very muchly.
doh, that works nicely, only thing is i wanted the button to change to a different pic depending on what character it was over, not just any character. is that possible?
Yeah, it's possible. you just have to add an extra layer of 'if..' coding, based on:
if (GetPlayerCharacter() == WHATEVER) {
SetButtonPic(..., ...);
}
im not sure how to implement that... here is what i tried to do using it. but it just made the button change to the same sprite regardless of which character it was over (player or npc)
if (GetLocationType(mouse.x,mouse.y)== 2)
SetButtonPic(INTY, 0, 1, 179);
if (GetPlayerCharacter() == 0)
SetButtonPic(INTY, 0, 1, 177);
if (GetLocationType(mouse.x,mouse.y)==0)
SetButtonPic(INTY, 0, 1, 175);
My mistake - didn't read the question properly. Don't know what I was thinking.
You need it to look something like this:
if (GetLocationType(mouse.x,mouse.y)== 2) {
if (GetCharacterAt(mouse.x, mouse.y) == 0) {
SetButtonPic(INTY, 0, 1, 177);
}
else SetButtonPic(INTY, 0, 1, 179);
}
if (GetLocationType(mouse.x,mouse.y)==0)
SetButtonPic(INTY, 0, 1, 175);
excellent, that works great.
thanks
1 last thing, i take it you can only do it with a maximum of 2 characters?
oh, and can rolling over a button change the image on another button?
ignore that, i just found GetGUIObjectAt that should do it i think
No, you can do as many characteras as you like:
if (GetLocationType(mouse.x,mouse.y)== 2) {
if (GetCharacterAt(mouse.x, mouse.y) == 0) {
SetButtonPic(INTY, 0, 1, 177);
}
else if (GetCharacterAt(mouse.x, mouse.y) == 1) {
SetButtonPic(INTY, 0, 1, 178);
}
else if (GetCharacterAt(mouse.x, mouse.y) == 2) {
SetButtonPic(INTY, 0, 1, 180);
}
else SetButtonPic(INTY, 0, 1, 179);
}
and so on, using 'else if'. And:
if (GetGUIAt(mouse.x,mouse.y) == INTY) {
if (GetGUIObjectAt(mouse.x,mouse.y) == 1) {
SetButtonPic(INTY, 0, 1, 177);
}
else SetButtonPic(INTY, 0, 1, 179);
}
should change the object 0 image, when the mouse is over object 1. That's not tested though, so it may not work.
EDIT: was typing this when you re-posted. Hope it helps anyway.
hm, something is a bit wrong with it, says parse error unexpected if. would that just be how ive put the script in though?
What line is the 'unexpected if' on? Can you show the code around it?
if (GetLocationType(mouse.x,mouse.y)== 2) {
if (GetCharacterAt(mouse.x, mouse.y) == 0) {
SetButtonPic(INTY, 0, 1, 177);
}
else SetButtonPic(INTY, 0, 1, 179);
}
if (GetLocationType(mouse.x,mouse.y)==0)
SetButtonPic(INTY, 0, 1, 175);
}
if (GetGUIAt(mouse.x,mouse.y) == INTY) { <-------------- this one
if (GetGUIObjectAt(mouse.x,mouse.y) == 1) {
SetButtonPic(INTY, 0, 1, 177);
}
else SetButtonPic(INTY, 0, 1, 179);
}
i dont think its your code, i think ive just screwed up =)
Try:
if (GetLocationType(mouse.x,mouse.y)== 2) {
if (GetCharacterAt(mouse.x, mouse.y) == 0) {
SetButtonPic(INTY, 0, 1, 177);
}
else SetButtonPic(INTY, 0, 1, 179);
}
if (GetLocationType(mouse.x,mouse.y)==0) { //<---- this runs on GUIs
if (GetGUIAt(mouse.x,mouse.y) == INTY) {
if (GetGUIObjectAt(mouse.x,mouse.y) == 1) {
SetButtonPic(INTY, 0, 1, 177);
}
else SetButtonPic(INTY, 0, 1, 179);
}
else SetButtonPic(INTY, 0, 1, 175);
}
As it was, there were two bits of script telling it what to do over a GUI (GetLocationType == 0, and GetGuiAt), which might've confused it, especially since this is the line that returned the error.
yeh that works great. you too kind.
only thing was i had to add another closing bracket at the end of the script