Posts ID:138870 Favorites Creations Medals
ID:138870

Code:
  Cmd1(X) if(X) src.Fire1 = "[X]" else if(src.Cmd1 == null) src.Cmd1 = "Left" winset(src,"Game.Cmd1","image = 'CmdLeft.png'") 

Problem description:

Optional Backstory: I have to rewrite Sea Battles to fit the new interface. So I tried this. My issue is that this is not changing the image when I click it. I've tried several variations and I've checked the skin reference. What's wrong here?
 #1 Oct 8 2011, 10:47 am You're certain Cmd1 is null?
 #2 Oct 8 2011, 11:10 am In response to Robertbanks2 (#1) mob/var/Cmd1 has no value.
Copy the image to the rsc first:

 var/A = fcopy_rsc('CmdLeft.png')winset(src, "Game.Cmd1", "image=\ref[A]") 
In response to ExPixel (#3)
  if(src.Cmd1 == null) var/A = fcopy_rsc('CmdLeft.png') src.Cmd1 = "Left" winset(src,"Game.Cmd1","image = \ref [A]") 

Still nada. I'm gonna dig through the procs a bit to see if I've overlooked something.
 #5 Oct 8 2011, 11:54 am In response to Lugia319 (#4) Don't put a space after \ref...remove the spaces in the third param of winset altogether.
In response to ExPixel (#5)
  Cmd1(X) if(src.Cmd1 == null) var/A = fcopy_rsc('CmdLeft.png') src.Cmd1 = "Left" winset(src,"Game.Cmd1","image=\ref[A]") 

Nothing. The Command of the button I am pressing is called Cmd1.

The variable definition is here.

 mob var Turn // Is the turn going? Hp // Health Cmd1 // Command 1 

I can't figure out what's going on.

EDIT: I've reduced it to where it should do the image change no matter what. Did not work. I've checked the ID of the button, nothing. I don't get why it doesn't work.
In response to Lugia319 (#6)
Is Cmd1(X) ever being called? Please check with a
 world "Cmd1([X]) has been called." 

debug output message to be sure.
 #8 Oct 8 2011, 2:29 pm In response to Green Lime (#7) Doah! Figured it out. It was coded as a proc. I didn't realize that I had two separate chat boxes. The person never had the verb! Sorry about my stupidity taking up your time :(