This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote
But sometimes, randomly, he will not go to the opposite side of the room
QuoteWhere in the global script am I supposed to put this?
Quote(How) does this correspod with the show_inventory_window() function?
QuoteDo I need a show_inventory_window() function if I want AGS to handle inventory clicks in script?
QuoteDo I want AGS to handle inventory clicks in script??
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() );
}
else if (button == LEFTINV) { // if left-clicked on an inventory item
// Do your stuff here, activate the clicked item, look at, use, whatever
// For example:
// SetActiveInventory(game.inv_activated); // pick inv item
}
else if (button == RIGHTINV) { // if right-clicked on an inventory item
// Do your stuff here, activate the clicked item, look at, use, whatever
// For example:
// RunInventoryInteraction(game.inv_actived, MODE_LOOK); // look at inv item
}
else { // right-click, so cycle cursor
SetNextCursorMode();
}
}
function on_event(int event, int data) {
//...
if (event == GUI_MDOWN) { // if mouse button pressed when over a GUI
if (IsButtonDown(RIGHT)) { // if right mouse button pressed
on_mouse_click(RIGHT); // call on-mouse-click function for default right mouse button action
}
}
//...
}
int LightOn=0; // 0 -> light initially turned off
if (LightOn == 1) // if light is turned on
SetBackgroundFrame(1); // display lit room background
else // if light is turned off
SetBackgroundFrame(0); // display unlit room background
if (LightOn == 1) { // if light is turned on
LightOn = 0; // turn light off
SetBackgroundFrame(0); // display unlit room background
}
else { // if light is turned off
LightOn = 1; // turn light on
SetBackgroundFrame(1); // display lit room background
}
QuoteI have a char that gives an item when he is talked to and I want to stop him for giving the item again if he is talked to again.
// script for character: Talk to character
if (GetGlobalInt(28) == 0) {
DisplaySpeech(GUY, "Here's your item.");
AddInventory(THE_ITEM_NUMBER);
SetGlobalInt(28, 1);
}
else {
DisplaySpeech(GUY, "I have nothing more to say.");
}
Quoteat the beginning of your global script file
QuoteWell spotted yes it's a bug, I'll fix it.
QuoteI think some are missing even though CJ said theyd be useful.
QuoteScript link failed: Runtime error: unresolved import
'InventoryItem::IsInteractionAvailable^1'
function repeatedly_execute() {
// (...)
if (IsGamePaused() == 0) {
if (GetLocationType(mouse.x, mouse.y) == eLocationHotspot) { // if mouse is over a hotspot
Hotspot *temp = Hotspot.GetAtScreenXY(mouse.x, mouse.y); // get hotspot
temp.GetPropertyText("IsExit", hotspotisexit); // check hotspot for exit
}
else if (GetLocationType(mouse.x, mouse.y) == eLocationObject) {
Object *temp = Object.GetAtScreenXY(mouse.x, mouse.y); // get object
temp.GetPropertyText("IsExit", hotspotisexit);
}
else if (GetLocationType(mouse.x, mouse.y) == eLocationCharacter) {
Character *temp = Character.GetAtScreenXY(mouse.x, mouse.y); // get character
temp.GetPropertyText("IsExit", hotspotisexit);
}
else StrCopy(hotspotisexit, ""); // nothing, gui or inventory
if (StrCaseComp(hotspotisexit, "") != 0) { // if mouse is over an exit
if (lastmodebeforeexit == -1) lastmodebeforeexit = mouse.Mode; // store current cursor mode
mouse.Mode = eModeWalkTo; // switch to walk mode
if (StrCaseComp(hotspotisexit, NoTranslateProperty("N")) == 0) mouse.UseModeGraphic(eModeN); // if mouse over exit North, change mouse cursor to North exit sprite
else if (StrCaseComp(hotspotisexit, NoTranslateProperty("NE")) == 0) mouse.UseModeGraphic(eModeNE);
else if (StrCaseComp(hotspotisexit, NoTranslateProperty("E")) == 0) mouse.UseModeGraphic(eModeE);
else if (StrCaseComp(hotspotisexit, NoTranslateProperty("SE")) == 0) mouse.UseModeGraphic(eModeSE);
else if (StrCaseComp(hotspotisexit, NoTranslateProperty("S")) == 0) mouse.UseModeGraphic(eModeS);
else if (StrCaseComp(hotspotisexit, NoTranslateProperty("SW")) == 0) mouse.UseModeGraphic(eModeSW);
else if (StrCaseComp(hotspotisexit, NoTranslateProperty("W")) == 0) mouse.UseModeGraphic(eModeW);
}
else { // if mouse is NOT over an exit
if (lastmodebeforeexit != -1) mouse.Mode = lastmodebeforeexit; // restore cursor mode (and mouse cursor)
lastmodebeforeexit = -1;
if (mouse.Mode == eModeInteract) {
if ((Hotspot.GetAtScreenXY(mouse.x, mouse.y) != hotspot[0]) || (Character.GetAtScreenXY(mouse.x, mouse.y) != null) || (Object.GetAtScreenXY(mouse.x, mouse.y) != null)) { // if mouse is over a hotspot, character or object
if (IsInteractionAvailable(mouse.x, mouse.y, eModeInteract)) { // if interaction is defined
mouse.UseModeGraphic(eModeUsermode1); // change mouse cursor to interaction indicator
}
else { // if hotspot interaction is NOT defined
mouse.UseDefaultGraphic(); // restore normal mouse cursor
}
}
//--- THE FOLLOWING PART CAUSES THE ERROR:
else if (InventoryItem.GetAtScreenXY(mouse.x, mouse.y) != null) { // if mouse is over an inventory item
InventoryItem *temp2 = InventoryItem.GetAtScreenXY(mouse.x, mouse.y); // get item
if (temp2.IsInteractionAvailable(eModeInteract)) { // if interaction for item is defined
mouse.UseModeGraphic(eModeUsermode1); // change mouse cursor to interaction indicator
}
else { // if interaction for item is NOT defined
mouse.UseDefaultGraphic(); // restore normal mouse cursor
}
}
//---
else { // if mouse is anywhere else
mouse.UseDefaultGraphic(); // restore normal mouse cursor
}
}
}
}
// (...)
}
Quotealthough it is set so that all text is shown as speech, the character's talking animation does not play while the text from looking at an inventory item is being said.
DisplaySpeech(GetPlayerCharacter(), "Blablabla");
function game_start() {
//...
game.skip_display = 0;
//...
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.898 seconds with 20 queries.