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 - tor.brandt

#61
Quote from: Khris on Wed 16/11/2016 00:11:07
I pasted the example code into a new script in a default game. I had to replace every instance of "eFontFont0" with "eFontNormal", but after that it worked fine.
Could you show the dialog script you're using to test this?

Default game template.

Room script:
Code: ags
// room script file

function hHotspot1_Talk()
{
  dDialog0.Start();
}


Dialog script:
Code: ags
// Dialog script file
@S  // Dialog startup entry point
return

@1
return
@2
return
@3
return


Option text:
1. "First dialog option"
2. "Second dialog option"
3. "Third dialog option"

Couldn't really be anymore basic, right?
But, alas, nothing happens in-game when I click the dialog options.

EDIT: Oh, and I changed the font name too, and I put the example code into a new script.
#62
Thanks for the replies!

@Crimson Wizard:
Good to know that my ideas were not totally rubish, and that there wasn't an obvious better option that I hadn't thought of (laugh)

@Jack:
I'm not sure if the effect I'm thinking of is created by thin clouds in real life, or if it's some kind of "atmospheric jitter", but what I'm after is really just having a white pixel that occasionally turns a darker nuance and then back again.
But thanks for the input! :)
#63
I want to make a background that has a sky with randomly blinking stars.
The randomness should behave in such a way that the stars are white most of the time, but then shortly shifts to some gray nuance now and then.

I'm thinking of either making objects with groups of stars (it would probably be grossly overkill to make separate objects for each star), and set those objects to shift frames with a Random int, or perhaps use the DrawingSurface.DrawPixel, and set the drawn pixels to shift color with a Random int.

Would you prefer either of those two options, or do you have a better idea for how I could obtain the same result?

Any suggestions appreciated!
#64
Really great module! :-D

I'm using it for my game, and it's working perfectly - except for one minor detail:
I  wanted to create a sort of "loop" dialog that shows only one option at a time, going through three options, such that when 1 is chosen, 1 = off and 2 = on, when 2 is chosen, 2 = off and 3 = on, and when 3 is chosen, 3=off and 1=on, then the dialog stops.
And then if the player engages the dialog again, the dialog script starts over again from the beginning.

However, when I try to start the dialog again, the game crashes with the error:
"Error running function 'dialog_options_render': Error: Array index out of bounds (index: -1, bounds: 0..2".
This also happens if I don't stop the dialog after option 3, but instead tries to jump right back to 1.

The error seems to be that the module is not able to switch on a previously switched-off option, if at the same time there are no other options on (it could, however, do it fine if there were other options on as well).
Is there an easy way to fix this?

PS. I'm not really sure if what I want to do would be a problem in AGS in general, or if it's specifically your module that is not able to handle it...?
#65
I'm trying to build a custom dialog options GUI.
For a start I have copy/pasted the script from the wiki (http://www.adventuregamestudio.co.uk/wiki/Custom_dialog_options_rendering) into my script, and it's rendering fine - but the dialog options don't respond to clicks.

I have a pretty long on_mouse_click funtion, so at first I thought it might be something in that that interferred with the clickability of the dialog options.
But I tried pasting the script into the default game template too, and the dialog options aren't clickable here either.

Would this be something I need to change/add in the dialog options script, or is it something I need to set somewhere in the AGS editor?
#66
Quote from: Cassiebsg on Sun 13/11/2016 15:13:07
Uhm? Why would you want a pause key that you need to keep pressing to keep the game paused?
That sounds very weird behaviour for a pause button. I would expect press key = pause game, press key again = unpause game. ???

Not really sure who you're asking, as I kinda also lost a bit track :smiley:

But if it's me, I don't want that, I want a perfectly normal press key = pause function like in the Lucas classics.
And that's what KeyPressAlways does (at least the way I use it).
#67
Quote from: monkey0506 on Sun 13/11/2016 12:26:13
I don't think the problem as you describe it has anything to do with my code, so much as it has to do with the way that on_key_press works. So, to clarify, are you holding down the Space key during a blocking event, or during non-blocking event(s) when this happens?

To be sure, I was not saying there is a problem with your code, just asking if that's how it was supposed to work, or if I had done something wrong? :smiley:
I have removed it from my script again, but I think the repeating toggle happened both during blocked and non-blocked...

Anyway, I now downloaded and imported your KeyPressAlways module, and that seems to do exactly what I was looking for, which is basically just the possibility of implementing a Lucas style pause function. So yeah, KeyPressAlways is perfect for my need, thanks!
#68
@monkey0506:

I'm still new to scripting, so I don't understand in full how your code works, but just to be sure:
I tried putting your first code (from your post 10 Nov, 5.49) into my global script, and that resulted in the behaviour I described (i.e. if Space was held down, pause was toggled repeatedly, instead of just once). Here I'm not talking about how the script works, but about the actual experience when playing the game.

Is this how it should work, or did I do something wrong? I'm sorry if you already answered this question, but I didn't quite get your reply.


@Crimson Wizard:
Thanks, I'll take a look at your module!
#69
@monkey0506:
That's alright :smiley:

I used the exact code you posted above, except I didn't assign
Code: ags
eKeyCode pauseKey = eKeySpace;

but instead just replaced "pauseKey" with "eKeySpace" in the on_key_press function.

Could that make the difference, and if so, how?
#70
@monkey0506:
I tried implementing your pause function, and it works (i.e. it does indeed pause even during blocking functions), but I have to tap the pause key really fast, or else it toggles again (i.e. unpauses). If I hold down the pause key, it toggles repeatedly until I release the key.
Is this how it should work, or have I done something wrong?
#71
No wait - So sorry, now I finally figured out what's wrong;
in the template the listbox selected text color is simply set to be the same as the selected background color, thus rendering the selected text invisible, whereas the textbox color is a different color.

Very clever. In fact so clever it took me many hours to figure it out.
#72
I am working on implementing a save game dialog in my game, but it turned out to be too difficult for my current scripting skill level.
Therefore I ripped the save game dialog script from the 9 VERB template, and pasted it into my own global script.
I am trying to get it to work with my own graphics, so the dimensions are a bit different than in the template, but I think I've got it corrected to fit my graphics.
Also, I changed the number of max save games from 99 to 19. I'm not presently able to decipher all of the code, so I'm not sure if I have caused some trouble anywhere in the script.
However, I have (at least) one problem still:
When I run the game, and select a slot in the save dialog that is already filled by a previous save game, the listbox text is not updated to match the text of the save textbox - this means that if I delete the save name in the textbox, the name is still visible "beneath" in the listbox, and whatever I type into the textbox is typed on top of the listbox text.
I've read through the script again and again, and I'm just not able to find where the problem is - but then again, I haven't been able to find where the listbox text should actually get its update from.

This is the relevant section from my global script:

Code: ags
int GStopsaveitem = 0;
int listBoxGap = 2;

function GetLucasSavegameListBox(ListBox* lb) {
  // stores savegames in slots
  String buffer, sgdesc;
  int maxsavegames, counter=0;
  maxsavegames=19;
  lb.Clear();
  while (counter<maxsavegames) {
    buffer=String.Format("%d.", counter + 1);
    sgdesc=Game.GetSaveSlotDescription(counter);
    if (sgdesc==null) sgdesc="";
    buffer=buffer.Append(sgdesc);
    lb.AddItem(buffer);
    counter++;
  }
  lb.TopItem=GStopsaveitem;
  lb.SelectedIndex=-1;
}

function btnSave_OnClick(GUIControl *control, MouseButton button)
{
  gOptions.Visible = false;
  GetLucasSavegameListBox(SaveListBox);
  gSave.Visible = true;
}

function Save_Click(GUIControl *control, MouseButton button) {
	int index = SaveListBox.SelectedIndex;
	String buffer;
	if (control==SaveCancel) {
		gSave.Visible=false;
		gSavetextbox.Visible=false;
    gOptions.Visible = true;
	}
	if (control==SaveOK && index >= 0) {
		buffer=SaveTextBox.Text;
		gSave.Visible=false;
		gSavetextbox.Visible=false;
		SaveGameSlot (index, buffer);
    gMainGUI.Visible = true;
    gActionText.Visible = true;
    mouse.Mode = eModeWalk;
    UnPauseGame();
	}
	if (control==SaveScrollUp) {
		gSavetextbox.Visible=false;
		SaveListBox.SelectedIndex=-1;
		if (GStopsaveitem < 5) GStopsaveitem = 0;
		else GStopsaveitem -= 5;
		SaveListBox.TopItem=GStopsaveitem;
	}
	if (control==SaveScrollDown && GStopsaveitem < 9) {
		gSavetextbox.Visible=false;
		SaveListBox.SelectedIndex=-1;
		GStopsaveitem += 5;
		SaveListBox.TopItem=GStopsaveitem;
	}
}

function SaveListBox_Click(GUIControl *control) {
  int saveBox_ypos;
  int saveBox_xpos;
 	int index = SaveListBox.SelectedIndex;

	String buffer = String.Format("%d.", index+1);
	SaveLabel.Text = buffer;
	buffer = Game.GetSaveSlotDescription(index);
	if (buffer==null) buffer="";
	SaveTextBox.Text = buffer;
	
  saveBox_ypos = gSave.Y + SaveListBox.Y + ((index - GStopsaveitem) * (GetTextHeight(SaveLabel.Text, SaveLabel.Font, SaveLabel.Width)+listBoxGap));
  saveBox_xpos = GetTextWidth(SaveLabel.Text, SaveLabel.Font);
  SaveTextBox.SetPosition(saveBox_xpos, 0);
  
  gSavetextbox.SetPosition(gSave.X + SaveListBox.X, saveBox_ypos);
	gSavetextbox.Visible=true;
}

function SaveTextBox_Click(GUI *theGui, MouseButton button) {
  if (mouse.IsButtonDown(eMouseRight)) gSavetextbox.Visible=false;  
}


Any help very much appreciated!
#73
@monkey0506:

Thanks, I'll try out your solution!
#74
Quote from: Riaise on Tue 08/11/2016 16:59:00
You can use the code in this post by Radiant to create a custom paused state, rather than using the built in one.

I'll take a look at that, thanks!


Quote from: Cassiebsg on Wed 09/11/2016 16:26:56
Don't know about other systems, but in windows you can either click outside the game window, and that will efectively stop the game (Assuming it's not set in config to continue running) even mid sentence. If you playing full screen, Alt+Tab should do the same, by existing the game and putting it on pause in the task bar... ;)
That's what I normally do if I want to pause a game.

Thanks, that's a good tip for me when I'm playing games, thanks!
What I'd like though is to put the function inside my game :smiley:
#75
Ah yes, I meant the latter.

And of course, how stupid of me, I hadn't even thought of looking at the dialog scripts in some of the templates.
Thing is, I'm not using a template, but writing my entire UI from scratch, both for the learning and for fun, and to avoid redundant code in my scripts.

But I will simply take a look at the templates, thanks!
#76
Does anyone know if the code modules for the built-in save and load dialogs are available anywhere?
I'd like to use the standard ones only with my own background and button graphics.
And besides, I'd like to read the scripts, so as to learn how they work.
#77
By the way;

It's really nice that I can put all my functions/function types in seperate regions, and then open one at a time to keep the script manageable, but it's a bit annoying that I have to close all the regions first thing every time I open AGS.

Is there a way to set the #regions to be closed per default when AGS opens?
#78
Quote from: Crimson Wizard on Tue 08/11/2016 14:34:21

I think the built-in pause in AGS currently is kind of "character-protection" pause, which main function is to suspend dynamic events, for example when you open inventory or options menu, like in old Sierra games where player could die.


Ah yes, of course, that makes sense :smiley:
#79
Quote from: Crimson Wizard on Tue 08/11/2016 14:39:36
It is hard to say how easy that would be to implement user-scripted pause. Suspending script functions in the middle (aka coroutines) is something that would require big script overhaul, which may be unrealistic with our lack of human resources.

Probably there are less costly options, like adding "above-game" built-in pause that would just lock any game update.

I don't care how the function is realized, as long as it works :smiley:
A built-in "above-game" (or meta-something or whatever) pause function sounds great to me, and it seems to me that something like that would do the job just fine.
Such a function would be awesome in a future version!
#80
Today I was working on the UI for my game, specifically on the pause game function, and then it occured to me that it's actually not possible to make an on_key_press PauseGame() function that overrides a currently running blocking script.
This means that it's not possible to pause the game e.g. while a character is speaking.

I'm still very much a newbie regarding scripting and how blocking scripts work, so I have no idea how much work and rework would need to be done to implement such a function in AGS, and perhaps the function is not worth the amount of work, BUT;

I for one think it would be awesome if it'd be made possible in some future version of AGS to make an on_key_press PauseGame() function that overrides a currently running blocking script, and somehow stores the running script and the current "position" within that script, such that it can be resumed after UnPauseGame().
SMF spam blocked by CleanTalk