I need it so when you left click in a certain inventory item that it will bring up a dialog how do I do this? ???
in on_mouse_click in global script:
if ((button==LEFTINV) && (game.inv_activated==x)) {
// code here
}
and replace the x with the inv items number...
Thanks TK.
But I still dont understamd where to put it.
This is my on_mouse_click thingy at present.
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1) {
// Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
if (GetCursorMode()==8) { ////////// this is the code for the inventory
InventoryScreen(); ////////// you don't have to include
} ////////// this message (good luck!)
}
else { // right-click, so cycle cursor
SetNextCursorMode();}
}
And do I put RunDialog(Whatever) after all this.
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1) {
// Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
if (GetCursorMode()==8) { ////////// this is the code for the inventory
InventoryScreen(); ////////// you don't have to include
} ////////// this message (good luck!)
if ((button==LEFTINV) && (game.inv_activated==x)) {
// code here
}
else { // right-click, so cycle cursor
SetNextCursorMode();}
}
I think...
This is the code in my dialog but it says RestoreGameDialog uknown request or something like that.
// dialog script file
@S // dialog startup entry point
return
@1 // option 1
RestoreGameDialog();
stop
@2 // option 2
SaveGameDialog();
stop
@3 // option 3
QuitGame;
stop
For your last problem, you can't put text scripts in dialogs. You need to use dialog requests. They are explained in the manual, under Conversations. Do something like this in your Dialog:
// dialog script file
@S // dialog startup entry point
return
@1 // option 1
set - global 1, 1
dialog req 1
stop
@2 // option 2
set - global 1, 2
dialog req 1
stop
@3 // option 3
set - global 1, 3
dialog req 1
stop
And in the function Dialog Request:
if(MODE == 1) && (GetGlobalInt(1) == 1)
{
RestoreGameDialog ();
}
else if(MODE == 1) && (GetGlobalInt(1) == 2)
{
SaveGameDialog ();
}
if(MODE == 1) && (GetGlobalInt(1) == 1)
{
QuitGame ();
}
Check it up in the Manual, I doubt my dialog functions are right.
How do I fuse the requests together?
function dialog_request(int parameter) {
if (parameter==1) {
SetDialogOption(4,2,1);
}
if (parameter==2) {
SetDialogOption(1,3,1);
}
if (parameter==3) {
SetDialogOption(4,3,1);
}
if (parameter==4) {
SetDialogOption(0,3,1);
}
} //end of dialog_request()
Fuse them together? What do you mean..?
I cant have two dialog requests so I have to put my old one with my new one but becuase im a newbie I cant work out where the new one goes and how many "}"s
and ";"s go in there.
Try this:
// dialog script file
@S // dialog startup entry point
return
@1 // option 1
run-script 5
stop
@2 // option 2
run-script 6
stop
@3 // option 3
run-script 7
stop
Then, in your function dialog_request:
if (parameter == 5) {
RestoreGameDialog ();
}
if (parameter == 6) {
SaveGameDialog ();
}
if (parameter == 7) {
QuitGame(1);
}
That last part should go right above the last "}" in your function dialog_request code.
~Wolfgang
The click thing wont work now.
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1) {
// Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
if (GetCursorMode()==8) { ////////// this is the code for the inventory
InventoryScreen(); ////////// you don't have to include
} ////////// this message (good luck!)
if ((button==LEFTINV) && (game.inv_activated==1)) {
// code here
RunDialog(7);}
}
else { // right-click, so cycle cursor
SetNextCursorMode();}
}
I left clcik while in it but its not working!!
Why?
When you bring up an inventory window GUI, it pauses the game.
if (IsGamePaused() == 1) {
// Game is paused, so do nothing (ie. don't allow mouse click)
}
This line tells the game not to accept any mouse clicks while the game is paused. Try moving your inventory interaction inside of those brackets instead, like such:
if (IsGamePaused() == 1) {
if ((button == LEFTINV && game.inv_activated == 1)) {
RunDialog(7);
}
}
~Wolfgang
I still cant make it work.
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1) {
if ((button == LEFTINV && game.inv_activated == 1)) {
RunDialog(7);
}
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
if (GetCursorMode()==8) { ////////// this is the code for the inventory
InventoryScreen(); ////////// you don't have to include
} ////////// this message (good luck!)
if ((button==LEFTINV) && (game.inv_activated==1)) {
// code here
RunDialog(7);}
}
else { // right-click, so cycle cursor
SetNextCursorMode();}
}
I need help with this before it gets knocked off the page.
why dont you put a "RunDialog(#);" in the "Any click" interaction in that inv. item?
That dosnt work either
Grah! Whats wrong wit it. >:(
oh yes, it should work! (i've tried it right now) but you have to leave the 'onmouseclick' function as you had it before.
Anyway, you could try to read the manual for this kind of questions, you´ll find the answer faster and get more confident with ags if you figure it out by yourself ;)
Still dosnt work.
I thought maybe its because I dont have a Any Click interaction I dont know what version of AGS you have but mine certainly dosnt have it.
Hey this script is a real delay in my game making pocess I cant test my game till it is finished im sorry for bumping but honestly if I dont I wont get an answer.
Maby you should explain what each if (GetCursorMode()==#) { should do, and get rid of the comment's, they make it a bit confusing... as you dont really need them. And by comments I mean the lines, or line ends, starting with //.
function on_mouse_click(int button) {
if (IsGamePaused() == 1) {
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
if (GetCursorMode()==8) {
InventoryScreen();
}
}
else {
SetNextCursorMode();}
}
There I took them out or did I take something out I wasn't supposed to.
And I don't know what they are supposed to do this is my first game and im trying to get to grips with scripting all I can do is explain as best I can so here it goes.
What I need is when you open the inventory window inside a game and click on the inventory item which is number 1 and then the cursor turns into that inventory item right. Then I need it so when you click anywhere on the screen while in that cursor that the Load Sava and Quit dialog appears and the dialog being number 7.
Um... sorry if I'm bieng stupid, but I don't understand... could you put that in steps, like
1. Click a button
2. Open GUI #
etc. (just an example)
1. Open inventory
2. Click on inventory item 1.
3.Inventory item 1 appears as cursor.
4. Click anywhere on the screen.
5. Open Dialog 7.
4 and 5 are the ones I need scripted.
the script you need: (I believe)
in on_mouse_click:
if ((button==LEFT) && (character[EGO].activeinv==1) && (GetCursorMode()==4)) {
RunDialog(7);
}
What do Itake out of this and where do I put the new script you just gave me?
function on_mouse_click(int button) {
if (IsGamePaused() == 1) {
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
if (GetCursorMode()==8) {
InventoryScreen();
}
}
else {
SetNextCursorMode();}
}
function on_mouse_click(int button) {
if (IsGamePaused() == 1) {
}
if ((button==LEFT) && (character[EGO].activeinv==1) && (GetCursorMode()==4)) {
RunDialog(7);
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
if (GetCursorMode()==8) {
InventoryScreen();
}
}
else {
SetNextCursorMode();}
}
:P
and btw
Quoteif (GetCursorMode()==8) {
InventoryScreen();
}
What is this supposed to make? I mean whats the idea of opening inv screen if the cursor mode is 8 when you click on the screen..? :J
I Just didnt like the GUI so I made anew way to make the inventory come up and now im working on geting save load and quit up you see.
...
Very offtopic, and unneeded, but: what does that mean?