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

#521
Editor Development / Re: AudioClip ID
Thu 30/03/2017 15:56:17
Quote from: Snarky on Thu 30/03/2017 09:23:12
Hold on! Your second, "easy" example is just the same as the first, except worse because it uses cryptic numbers instead of transparent names.
Read my post more carefully, it IS easier when you can store the mapping in an external data file and you only need to have a for loop instead of hundred lines of codes. Also, IMO using well defined numerical indices is much less error prone than names, as long as you have good planning you can manage this easier, but to each his own, I wouldn't argue on this aspect. Also, I already mentioned I actually don't need this kind of mappings myself as I don't need multiple lists of different orders. It's because CW mentioned multiple lists that I explain why it is easier to manage with numbers instead of names. If there is only one list you don't even need to do anything in the script to remap everything.

Quote from: Monsieur OUXX on Thu 30/03/2017 10:56:08
Could you give an accurate example of such use? A module you made, maybe?
I've already posted an example in how to choose the appropriate sprites for use in a tile map. This is what I am really doing in my game, but I was just to lazy to dig up the actual codes and show the actual formulae, etc. Also, personally I don't write modules often, as I'd rather put everything in one place, so when I want to reuse codes I just copy-paste codes from one project to another and make necessary modifications to them to more match the new project's need.
#522
Editor Development / Re: AudioClip ID
Thu 30/03/2017 05:31:44
Quote from: Crimson Wizard on Thu 30/03/2017 03:22:35
If you mean getting numeric index of particular clip by its pointer, like clip.ID, then there is no such thing, but can you explain why do you need that?
No, I didn't mean clip.ID (it's not that useful anyway), I just meant whether the array itself is accessible via script(as I mentioned I haven't tried 3.4 yet), if it is the problem is already solved.

Quote
... what's so difficult to start making one from the beginning of the game, and keep adding to it while you are progressing futher?
This is not actually difficult, but is actually awful, to include such a HUGE chunk of codes doing nothing apart from tiresome assignments. Personally I think the less resource management done in the scripts the better. This is like, striping the function to assign sprites to individual frames of individual loops in the editor, and require the users to put such stuff in the scripts themselves, which is quite bad.

Quote(Or, alternatively, by exporting audio clip's Name into script API, which would let you parse index/string pairs)
This is a solution too, though not as straight forward and simple as maintaining just an array of numbers.

Quote
The thing is that in either case you must maintain a numbered list of clips:
1) by appropriately naming sound files on disk (while loosing meaningful titles)
OR
2) by appropriately asigning sound names to array in script.

I sincerely cannot see why the first is better/easier than the second. Or maybe I am missing something...
Actually I never said it's a good idea to force users to name sound files according to some conventions (like the old system), what I really said was that as long as you have a global array of indices of all the sound clips and that you can manually reassign them when needed, like with sprites. There is nothing wrong to have meaningful script names for the clips(though it's not useful to me), as long as after importing the file into the editor it is still assigned an index number, and that index could be manually changed and accessible via script then it's done. So, if these features are already in 3.4+ then there is nothing to worry.

Quote
Although that's technically possible to re-add global ID to audio clips if this all is so serious... I guess AGS is just so numbers-based that it takes more effort to support name IDs properly in both script and UI.
I'm quite serious with this though. I haven't thought of other use for sounds yet, but making it easy to say play a random sound from a certain index range, or jukebox like stuff are good enough reasons already. Finding the index to an entity is quite handy and important (which is not so easily done when you can only use "OO" style script names for stuff), for example, in a certain (not done yet) game I use them to draw tiles on the playfield. I may say number a tile with the number "UDLRNN", where NN is the base index of an sprite (such as a tree, or a wall) and the four digits UDLR are determined by what are present in the four adjacent squares, so you may easily choose the right sprite according to what are around the square.
#523
Editor Development / Re: AudioClip ID
Thu 30/03/2017 02:59:51
Quote from: Crimson Wizard on Wed 29/03/2017 22:44:30
First of all, since AGS 3.4.0 there is Game.AudioClips array where you can access audio clips by numeric index. You can even modify that index in project by reordering items by dragging them around. The caveat...
I haven't tried v3.4 onward yet, but if this is accessible then it is fine, but from your descriptions do you mean the numerical IDs aren't accessible by script yet? Then it's not very useful.

Quote
I do not agree that the method to index audio clips are complicated, it is just about creating an array of AudioClip references in script. This way you could even have same audio clip in two or more lists to choose from with different algorithms if wanted. There are script modules for making playlists with random shuffle and stuff. Of course, all this comes at the cost of extra scripting.
It IS complicated if you have to do something like below, which repeats hundreds of time:
Code: ags

AudioClip ac[100];
ac[0] = aScream;
ac[1] = aShout;
...

This cripples codes very heavily which should be unnecessary before the changes. I understand how the new system can be useful to some people(which personally is useless to me though) but sacrificing some really handy features for this is not a really good idea.
For multiple lists(which I don't need) it is actually even easier to do with just numbers than the names. For example, you can make another remapping array easily, like:
Code: ags

int alist2[100];
alist[0] = 5;
alist[71] = 71;
...

You may even put these remapping indices in an external file, load the file in the script and use a for loop to do the mappings, which is much cleaner.

About the subfolder and global indices thing(sorry I haven't read the whole post in detail yet), IMO the subfolders are just for easy management of resources, and are not necessarily related to the internal indices. Personally I think a global index which is unique to each clip is enough, though I won't oppose to have something like audiofolder1.clip[4], etc.
#524
Quote from: Monsieur OUXX on Wed 29/03/2017 09:39:08
I was actually wondering: what's the point of letting people set their own ID for a sprite or object?
I use that A LOT. This is a very important feature for say display the appropriate sprite according to certain formula.
It's a pity that the audio clips in the renewed audio system couldn't be referenced by numbers without complicated methods, so IMO the current AGS versions are broken and thus I refuse to use the recent versions.
#525
Link expired. :sad:
#526
@slasher: The OP already mentioned the "keycode" method didn't work. It's been a long time since I touched this, but AFAIK one indeed should use the OnActivate method.

For the text to disappear, as mentioned, set the Text property of the text box to empty. Check the script name of the text box (the default is something like "TextBox1" if you didn't change it), and put in the script:
Code: ags
TextBox1.Text = "";


However, since you destroy the content of the text box when you blank it, if you need to do something according to its contents (such as parsing the String in a text parser) you need to do so first before emptying it. Something like:
Code: ags

function TextBox1_OnActivate(GUIControl *control)
{
  //Do whatever actions you want here according to the contents of the text box
  //...
  
  TextBox1.Text=""; //blank the text box
}

Alternately, you may copy the content of the text box to another String first, and then blank the text box, so you may take action according to the contents of the new String instead, but hey, one step at a time! :wink:
#527
Actually the Enter key is treated a little differently in a text box.
Pressing the Enter key means "activating" what you just typed in the box.
So, in the editor, select the text box on the GUI and then choose the Events tab (the lightning icon) on its property pane. The text box should have only one event listed, OnActivate. Click the "..." on the space on the right of this event and a new function called something like TextBox1_OnActivate() will be created in the Global Script.
You may then put whatever responses you want to have inside this function whenever the player presses Enter while the text box is active.
#529
The Rumpus Room / Re: Name the Game
Tue 14/02/2017 14:59:16
One of the Biohazard games?
#530
The Rumpus Room / Re: Name the Game
Tue 14/02/2017 07:32:58
One of those Commander Keen games?
#531
The Rumpus Room / Re: Name the Game
Tue 14/02/2017 06:52:56
The story of Bubble Bobble 2: Rainbow Island?
#532
Engine Development / Re: Direct3D issues list
Thu 09/02/2017 05:15:09
Quote from: Crimson Wizard on Wed 08/02/2017 21:14:52
PS.
All this actually made me think, what if it may be possible to run 8-bit games on Direct3D, in 32-bit display mode?
8-bit images and palette is in control of Allegro library, and it is possible to just copy their contents to the texture using rather simple pixel conversion algorithms.
If this is possible, would the conversion be done in every single frame (my guess is this isn't necessary for 16-bit games)? Otherwise I don't think palette effects could ever be done. I mainly work with 8-bit graphics as I abuse palette effects, and that the games won't even run under D3D is a real bummer(considering that more and more people claim that DX doesn't work in their rigs). I wonder whether it will cause much slowdowns if it's to be done every frame, but if palette effects have to be sacrificed to use the D3D renderer IMO it's just useless. I remembered 8-bit games work under Android (checked very old JJS builds only; not checked recent builds yet). How is this done? Does OGL just use 8-bit textures directly? In that case, maybe making OGL selectable in the Windows engine is also a solution? (I haven't checked the recent versions yet, so if this is already possible just ignore me.)
#533
The Rumpus Room / Re: *Guess the Movie Title*
Mon 06/02/2017 15:35:48
American Pie 2016 :grin:
#534
Try to change the 'while' in repeatedly execute to 'if' and see if it's slow enough.
If you put a while loop there, the volume will be reduced to the minimum value in one single frame.
#535
The Rumpus Room / Re: *Guess the Movie Title*
Wed 18/01/2017 16:59:59
Pudding* KaratekaBattle* Galactica?
#536
The Rumpus Room / Re: *Guess the Movie Title*
Sat 14/01/2017 17:09:19
Actually I wrote Lemmings not because of that 'thing' as I didn't even notice something lurking in that forest shot. Instead I was referring to that NSFW shot. :grin:
#537
The Rumpus Room / Re: *Guess the Movie Title*
Thu 12/01/2017 14:31:20
Lemming: The movie
#538
The Rumpus Room / Re: Name the Game
Fri 30/12/2016 01:01:22
LoomTM?
#539
Quote from: Crimson Wizard on Sun 11/12/2016 14:09:23
PS. I believe this question should be moved to AGS Tech Support section.
Oh. I was not aware that I had mod power over the site report forum. But now I think I've moved this thread to the wrong section (this section is mainly for releases). :embarrassed: I think this thread is still marginally related here though, so CW, if you don't see it fit, feel free to move this thread again to somewhere else.
SMF spam blocked by CleanTalk