Post new topic    
Slime Knight
Send private message
Issues with "get color" and "set color" 
 PostTue Apr 03, 2012 8:59 pm
Send private message Reply with quote
Hi all!

I'm having a bit of trouble with one aspect of the palette-tweaking commands "get color" and "set color" and was hoping someone could shed some light on the matter. What's happening is that during a certain period, I'm running a while loop that causes 6 colors from my master palette to change positions with one another (such that the color at the 1st position jumps to the 2nd, the color at the 2nd position jumps to the 3rd,... the 6th to the 1st, and so on). This part works perfectly.

Code:

plotscript, titleanimate, begin

#this is just a reference to the 6 color's original index values
#color1: 253
#color2: 251
#color3: 199
#color4: 151
#color5: 39
#color6: 227
variable(color1)
variable(color2)
variable(color3)
variable(color4)
variable(color5)
variable(color6)
variable(t)

while(checktag(19)==0), do,
begin

for (t,1,6,1), do,
begin
color1:=getcolor(253)
color2:=getcolor(251)
color3:=getcolor(199)
color4:=getcolor(151)
color5:=getcolor(39)
color6:=getcolor(227)
setcolor(227,color5)
setcolor(39,color4)
setcolor(151,color3)
setcolor(199,color2)
setcolor(251,color1)
setcolor(253,color6)
updatepalette
wait(1)
end #end for loop

end #end while loop

end #end script


Like I said, that works perfectly. What DOESN'T work is that when I break the while loop by turning tag 19 on and using a door, the master palette does not return to its original settings, no matter what I do.

I've tried storing the original RGB values of the 6 colors in variables before the tweaking script is run, then writing them back in after the fact, but no go. Maybe I was just doing this wrong?

Right now, I've gotten so frustrated that I've imported a 2nd copy of the original master palette and was just trying to switch over to it after the tweaking script. To my knowledge, this 2nd master palette should have been uncorrupted, but for some reason, when I load it, it retains the tweaks caused by the tweaking script, instead of the original default values!

Code:

plotscript, titlenewgame, begin
settag(19,on)
loadpalette(2)
updatepalette
usedoor(0)
resumeplayer
end


Any ideas what is going wrong?
Thanks in advance!
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Super Slime
Send private message
 
 PostTue Apr 03, 2012 9:06 pm
Send private message Reply with quote
Have you tried "reset palette"?
Mega Tact v1.1
Super Penguin Chef
Wizard Blocks
Liquid Metal King Slime
Send private message
 
 PostTue Apr 03, 2012 9:17 pm
Send private message Reply with quote
Yeah, Mogri is right. Your script does not appear to have any reset palette so there is no reason to expect the palette to go back to the way it was.

Right after the end of the while loop would probably be the best place for it.
Slime Knight
Send private message
 
 PostTue Apr 03, 2012 10:33 pm
Send private message Reply with quote
I was pretty sure "reset palette" was one of the things I had previously tried, but I tried it again, both right after the end of the while loop in the first script, and after the "settag(19,on)" in the 2nd script. Neither one works!

Actually, I should say it doesn't work *reliably*. I ran the problematic area of the game ten times, and ONE out of those ten times, the palette seemed to reset to its proper colors. This can be seen in case 1 in the screenshot below. The other 9 times, it kept messing up in the usual ways, as shown in cases 2 and 3:



What gives?
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Liquid Metal King Slime
Send private message
 
 PostTue Apr 03, 2012 10:39 pm
Send private message Reply with quote
I would like to see more of the script.

Also, you should add something like:

Code:

reset palette
update palette
$0="Reset the palette back to default"
show string(0)


to make absolutely sure that the reset code is actually being run, and not being skipped somehow.
Slime Knight
Send private message
 
 PostTue Apr 03, 2012 10:45 pm
Send private message Reply with quote
Guh, seems the problem was just me being foolish. For some reason, when I plugged in "resetpalette", I took out "updatepalette". With the both of them present, of course it works.

Thanks for all your help! ;_;
SPELLSHARD: THE BLACK CROWN OF HORGOTH now COMPLETE! Grab it today!
Liquid Metal King Slime
Send private message
 
 PostWed Apr 04, 2012 2:03 pm
Send private message Reply with quote
Yay! I am glad to hear it is solved :)
Display posts from previous: