ok this is my global scrip part for a siple GUI
function interface_click(int interface, int button) {
if (interface == GUI1) {
if (button == 1) {
SetCursorMode(MODE_LOOK);
}
if (button == 2) {
SetCursorMode(MODE_USE);
}
if(button==3) {
SetCursorMode(MODE_USEINV);
}
if(button==4) {
GUIOn(Q);
}
if(button==5)
GUIOff(GUI1);
}
}
if (interface== Q) {
if (button==0) {
GUIOff(Q);
}
if (button==1) {
QuitGame(0);
}
}
if (interface==GUI2) {
if(button==0) {
SetCursorMode(MODE_PICKUP);
}
if(button==1) {
SetCursorMode(MODE_LOOK);
}
if(button==2) {
GUIOn(GUI1);
}
}
problem when i try to test game there is error un expected "if" on line 91 (its where the line is if(interface==Q) {
I cant undrestand what is the f***ing problem?
Line 89 ( if(button==5)) is missing a {, so line 90 effectively closes interface_click, giving the error. Add the { to line 89, and it should be OK.
Also, if there's only one line, you don't actually need the braces:
function interface_click(int interface, int button) {
if (interface == GUI1) {
if (button == 1) SetCursorMode(MODE_LOOK);
if (button == 2) SetCursorMode(MODE_USE);
// Etc
}
if (interface== Q) {
//etc
}
}
Would work just as well.
Thanks a lot
EDIT: i tryd it and it works now