Can't get control panel to show up (SOLVED)

Started by FamousAdventurer77, Sun 22/05/2011 20:50:46

Previous topic - Next topic

FamousAdventurer77

Can't get the control panel to appear on screen if I click it in the icon bar. Would I start with this:


function btnControlPanel_Click(GUIControl *control, MouseButton button)

but what's the right command for "gPanel" to show and work correctly?
If you want to know the Bible's contents, just watch Lord of the Rings or listen to the last 8 Blind Guardian albums. It's pretty much the same thing.

Khris

Just turn it visible:

Code: ags
  gPanel.Visible = true;

barefoot

Hi

I'm assuming you are not customising the gIconbar and are using it normally.

if you have not touched any scripting and the gIconbar is visible then you should only have to click on the ? button on the right of the gIconbar, else press Escape key to bring it up.

You don't normally have to touch anything.

Not sure what else it could it be..

barefoot

I May Not Be Perfect but I Have A Big Heart ..

barefoot

Yes, if you have set it as invisible..

barefoot
I May Not Be Perfect but I Have A Big Heart ..

FamousAdventurer77

Nope, I modified the icon bar to have 10 icons, I removed the ? and have a picture of sliding bars resembling a control panel. But I'll give Khris's line a whirl and see if that works.
If you want to know the Bible's contents, just watch Lord of the Rings or listen to the last 8 Blind Guardian albums. It's pretty much the same thing.

FamousAdventurer77

Argh! Didn't work. Here's what I put in:

function btnControlPanel_Click(GUIControl *control, MouseButton button) {
 
  gPanel.Visible=true;
}


Still does nothing if I click it. Works if I hit Escape though.
If you want to know the Bible's contents, just watch Lord of the Rings or listen to the last 8 Blind Guardian albums. It's pretty much the same thing.

barefoot

Hi

Just on case you messed up here is the original script.

The gIconbar ? (image) events button is btnIconAbout.. when you click it:

Code: ags

gPanel.Visible=true;
  gIconbar.Visible=false;
  mouse.UseModeGraphic(eModePointer);


barefoot
I May Not Be Perfect but I Have A Big Heart ..

Khris

In that case it sounds like the button's function isn't linked properly.
Usually you'd simply double-click the button after creating it, this creates the function and links it.

Open the Iconbar GUI, select the control panel button, then click the lightning icon. Below that it should say "OnClick" and next to it: "btnControlPanel_Click".
That's how AGS knows to call the function upon a click on the button.

FamousAdventurer77

Quote from: barefoot on Sun 22/05/2011 21:38:30
Hi

Just on case you messed up here is the original script.

The gIconbar ? (image) events button is btnIconAbout.. when you click it:

Code: ags

gPanel.Visible=true;
  gIconbar.Visible=false;
  mouse.UseModeGraphic(eModePointer);


barefoot



I deleted the About button because I don't feel like re-scaling my inventory buttons and it's not necessary for gameplay. My button is labelled btnControlPanel.
If you want to know the Bible's contents, just watch Lord of the Rings or listen to the last 8 Blind Guardian albums. It's pretty much the same thing.

FamousAdventurer77

Quote from: Khris on Sun 22/05/2011 21:56:34
In that case it sounds like the button's function isn't linked properly.
Usually you'd simply double-click the button after creating it, this creates the function and links it.

Open the Iconbar GUI, select the control panel button, then click the lightning icon. Below that it should say "OnClick" and next to it: "btnControlPanel_Click".
That's how AGS knows to call the function upon a click on the button.

I thought that was the problem too but when I go into the Iconbar window and get to the control panel button, then click Events, the "btnControlPanel_Click" box leads me to the first few lines of code in the main global script file. Do I just put that same code, linked correctly, somewhere below that?
If you want to know the Bible's contents, just watch Lord of the Rings or listen to the last 8 Blind Guardian albums. It's pretty much the same thing.

Khris

If it takes you to the function with "gPanel.Visible = true;" inside,  everything should work fine.
I don't know why it still won't work, but to be really sure, put this before the Visible line:

Code: ags
  Display("Test.");


If you click the button, does it display that? Also, please post the entire function you currently have.

FamousAdventurer77

There's this function that doesn't seem to do anything under "Start of Control Panel Functions":

Code: ags
function gControl_OnClick(GUI *theGui, MouseButton button)
{
  gPanel.Visible = true;
  mouse.UseDefaultGraphic();
  gIconbar.Visible = false;
}



Here's what I tried using that does absolutely nothing despite clicking on the correctly-labelled icon bar button:

Code: ags
function btnControlPanel_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = true;
  mouse.UseDefaultGraphic();
  gIconbar.Visible = false;
}


What am I doing wrong??? I really don't understand. The freakin button is properly labeled.
If you want to know the Bible's contents, just watch Lord of the Rings or listen to the last 8 Blind Guardian albums. It's pretty much the same thing.

Khris

Like I said, make sure the function is called. Read my previous post.

FamousAdventurer77

Solved it!

Here's the utterly stupid and obvious thing I missed...

That damn lightning bolt button. I just had it as "btnControlPanel", not "btnControlPanel_OnClick". That and I realized with the last 10 times I hit F5 to try out other scripting aspects, just HOW crucial it really is to go through that Event button first. Doesn't matter if you script first or after hitting it, but I'm hitting it first from now on so I don't get confused. And my script was correct, just wrong label. Definitely leave this here for other beginners with the same problem though.

And now that I see the control panel I designed pop up on screen....yeesh I need to scale that thing down.
If you want to know the Bible's contents, just watch Lord of the Rings or listen to the last 8 Blind Guardian albums. It's pretty much the same thing.

Khris

Since you didn't get an error message, there's a function called btnControlPanel somewhere in your script. Better get rid of it to avoid future confusion.

FamousAdventurer77

Nope, only one is btnControlPanel_OnClick. I think it was mislabelled in the Events window the entire time.
If you want to know the Bible's contents, just watch Lord of the Rings or listen to the last 8 Blind Guardian albums. It's pretty much the same thing.

Khris

You're right, I just tested it and didn't get an error.
It still throws an error for missing room functions though, but apparently not for missing OnClick ones.

FamousAdventurer77

I got TONS of errors when the stuff in the rooms didn't match up-- whereas it didn't create a fatal error for the control panel one, the icon just didn't work. I got it to work correctly now though.
If you want to know the Bible's contents, just watch Lord of the Rings or listen to the last 8 Blind Guardian albums. It's pretty much the same thing.

SMF spam blocked by CleanTalk