Menu

Show posts

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 Menu

Messages - strazer

#1722
No, I don't think it's possible at the moment.

Here's a related tracker entry: http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=163
#1723
Quote
But sometimes, randomly, he will not go to the opposite side of the room

Hm, strange. Does the room change occur at all?

Btw, right is EAST, left is WEST. ;)

Edit:

You say this is an excerpt. NewRoomEx is a delayed-response function, meaning it doesn't get executed until the script finishes. Do you have any code after this that could affect it?
#1724
And maybe rename the "Talking view" button in the Characters pane to "Speech view" to be consistent with the SpeechView property?

In fact, I'd suggest naming stuff closer to the respective property name, i.e.

No diagonal loops -> Diagonal walking
Can be walked through -> Solid

Edit:

Hm, we have a tracker entry for completely disabling diagonal walking, BASS-style.
It seems to me the DiagonalWalking property name is a bit ambiguous. Maybe it should be called DiagonalLoops or something?

Edit 2:

Is it possible to only exclude a struct name from the autocomplete feature?
If I try it putting "// $AUTOCOMPLETEIGNORE$" after the struct name, it disappears from the list, but none of the members for instances of the struct are autocompleted anymore.

Edit 3:

The manual still refers to "player" as an alias to character[EGO] which is not being updated.
#1725
QuoteWhere in the global script am I supposed to put this?

It's just important that you put this on_event function after the on_mouse_click function into the global script because the former one calls the latter in my example.
Since you don't have an on_event function in your global script already, you can just add the above code to the end of your global script, after everything else.

Quote(How) does this correspod with the show_inventory_window() function?

It doesn't.
Your show_inventory_window function displays your customized inventory gui. That's it.

QuoteDo I need a show_inventory_window() function if I want AGS to handle inventory clicks in script?

As the manual states (Tutorial -> Setting up the game -> Game options), you can't use "Handle inventory clicks in script" with the built-in inventory gui.
Since you use a custom one (called INVENTORY), there shouldn't be a problem.

QuoteDo I want AGS to handle inventory clicks in script??

It depends.
If you want to change the default behaviour of clicking on inventory items, yes. If you're okay with it, no.

If you decide to handle the clicks yourself, change your on_mouse_click function to this:

Code: ags

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();
  }
}
#1726
Try this:

Code: ags

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
    }
  }

  //...
}


and make sure on_event is located after the on_mouse_click function in the script so it can call it.
#1727
You're welcome. :)
#1728
You have to put the scripts in seperate events:

Declare the variable at the very top of the room script ("{}" button), outside of any functions:
Code: ags

int LightOn=0; // 0 -> light initially turned off


Into the room's "Player enter screen (before fadein)" function:
Code: ags

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


In the lamp object's interaction:
Code: ags

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
}
#1729
I'm still not entirely sure what you mean, but here goes:

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.

Interaction editor way:

Talk to character
  Conditional - If a variable is set to certain value: 28, 0
      Game - Display a message: "Here's your item."
      Player - Give the player an inventory item
      Game - Set variable value: 28, 1
      Stop running more commands
  Game - Display a message: "I have nothing more to say."

Script:

Code: ags

  // 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.");
  }
#1730
I don't know what you mean. What do you want to do?

Character functions are in the manual:
AGS v2.62: Text script functions -> Character functions
AGS v2.7: Scripting -> Character functions and properties
#1731
Quoteat the beginning of your global script file

To reduce clutter in the global script, you can also put the variable in the room script.
Its value is retained even when you change rooms.
#1732
Ok, I have added them:

http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=503
http://www.adventuregamestudio.co.uk/tracker.php?action=detail&id=504

Be sure to let me know if you find anything else CJ-approved that I've missed.
#1733
Here are my thoughts:

Documentation

I prefer external text files. It's easier to have them in a seperate window if you quickly need to look something up while having the script editor open.

Programming Conventions

Yes, a prefix should definitely be used. I also think adding a (maybe abbreviated) prefix to function names would help grouping related functions for the auto-complete feature.

Publishing, Licensing, etc

I think we should use zip files, containing the scm file, documentation and optionally a simple demo game.
At these small file sizes the superior compression ratio of rar or ace is insignificant.
Zip files are easiest to access on all platforms.

I don't know what specific license to suggest, but the module author should definitely write something in the docs. Is it free for non-commercial AND commercial use? Is a credit required or optional?

As for module manager permissions, I will release my modules with all permissions granted. The beauty of modules is that you can customize them to your needs, so it should be possible to do so.

If you want users to credit you for your work, just say so and I'm sure most people will be happy to do so.

Announcing, Reviewing, Release Module List

I was wondering about that myself.
I think they should be announced and debugged in the Technical Forum, then moved to the Technical Archives just as Tools and Plugins are now.
#1734
We have a tracker entry for ENTER_ROOM_AFTER_FADEIN, should we rename eEventEnterRoom to eEventEnterRoomBeforeFadein to avoid confusion?

QuoteWell spotted yes it's a bug, I'll fix it.

Ah, ok, thanks. I thought I made a mistake when converting my script. :)

Edit:

I meant ENTER_ROOM_AFTER_FADEIN of course.  :P
#1735
QuoteI think some are missing even though CJ said theyd be useful.

What suggestions are you referring to, specifically?
#1736
I decided to update my main game to the new object-based scripting using AGS v2.7 Beta 15.
It compiles fine, but upon testing, I get

QuoteScript link failed: Runtime error: unresolved import
'InventoryItem::IsInteractionAvailable^1'

Here is an excerpt of my global rep_ex function that contains the part that causes the problem:

Code: ags

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
			}
		}
	}
  }

  // (...)

}


I'm just getting used to this, so I'm sure I'm missing something obvious here.

Edit:

Changed
  Hotspot.GetAtScreenXY(mouse.x, mouse.y) != null
to
  Hotspot.GetAtScreenXY(mouse.x, mouse.y) != hotspot[0]
since hotspot 0 is returned if there's no hotspot there.
#1737
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.

Does the time-out work if you don't use "Always display text as speech"?

Well, if you don't need the Display textbox anyway, why not just use normal speech?
I assume you're trying this workaround because there's no Interaction Editor command for that?
It's quite easy using script: Just add a "Run script..." action, click "Edit script..." and write
Code: ags

  DisplaySpeech(GetPlayerCharacter(), "Blablabla");

That's it.
The talking animation should play fine as long as you've set a talking view for the character.
#1738
It's a variable, so you can change its value directly (in script), like this:

Code: ags

function game_start() {
  //...

  game.skip_display = 0;

  //...
}


Check "SetSkipSpeech" in the manual to see what values you can use.
#1739
I think game.skip_display is what you're looking for. See manual (Reference -> Text script global variables).
#1740
Does it also happen if you do it manually, i.e.

if (player.View == YOURVIEW && player.Loop == YOURLOOP && player.Frame == 2) PlaySound(3);

?
If so, do you have any other sounds that are played from rep_ex or do you have a lot of other characters with frame sounds walking around in the room?
Since there's a limited number of sound channels, maybe the sounds are being played but are cut off immediately by another sound started somewhere else.
SMF spam blocked by CleanTalk