AuthorTopic: Ask something - We can help. (Read 169637 times)

What anti-virus are you guys running? I use Avast Free, and I am convinced it hates AGS and causes all kinds of weird crappy behaviour on my computer (ie. massive delay to keystrokes in harmless software like WordPad)Looking for an alternative...

Suddenly MIDI does not work on my Win10 PC anymore No matter what MIDI program I use (media player, VLC, midi editing tool), none of them can find the Windows MIDI device.I have the Microsoft GS Wavetable Synth listed in Device Manager->Software devices, tried to deinstall/install it, still doesn't work.

I have no idea about the cause of your problem but I'd use instead an alternative driver such as BASS MIDI driver, that uses Soundfont instruments files and provide a much better MIDI quality than default Windows MIDI driver.

Edit : a good and free soundfont working with the BASS driver can be found here.

alright so to begin with, can you make me understand the working of this code

please explain me how is the romanise function is working here

OK, so this code is meant to print a number in Roman numerals. So we first have to make sure we understand how Roman numerals work.

Basically, you have a set of symbols: M (1000), D (500), C (100), L (50), X (10), V (10) and I (1). Usually, to read a number you just add all the "digits" together. For example, MMXVII = M + M + X + V + I + I = 1000 + 1000 + 10 + 5 + 1 + 1 = 2017. This is the "simple" method, and we always go from the highest to the lowest symbol.

One twist: commonly, instead of writing 4 as IIII and 9 as VIIII, you write it as IV and IX (smaller digit first, meaning you subtract it from the higher digit instead of adding them). You'll sometimes see the same logic applied to 40 (written XL instead of XXXX), 90 (XC instead of LXXXX), 400 (CD instead of CCCC) and 900 (CM instead of DCCCC), but that's more of a modern convention, and this code doesn't do it.

OK, so how do we write a number in this format? It should be pretty obvious, but let's break down the steps:

You start with the highest symbol (M), and see how many times it "fits" into your number. You repeat it that many times (which can be zero), and then move on to the next symbol, fitting it into the part of the number remaining. So for 2017, we ask "how many times does 1000 go into 2017?" The answer is 2, so we write M twice: MM (2000). We subtract 2000 from 2017, leaving 17. Now we ask the same for D (500), C (100) and L (50). In each case, the answer is 0 (all those numbers are bigger than 17), so we don't write anything. When we get to X (10), the answer is 1, so we write a single X after MM: MMX. We subtract 10 from 17, leaving 7, ask how many times V (5) goes into 7 (once), giving MMXV and leaving 2, and finally ask how many times 1 goes into 2 (twice), giving us MMXVII.

And that's pretty much what the code does. It breaks the task down into handling each symbol, which is done by the romanise() function. It takes three arguments: the first (y) is the number you want to write. The second (k) is the value of the symbol you want to try to fit into that number. The third (ch) is the character representation of that symbol that you want to print. The function prints the symbol ch as many times as its value k fits into the number y, and returns how much of the number is left over:

Code: C

j=y/k;// How many times does k fit into y (divide y by k, rounding down)

return(y-k*j);// Return the part of y that is left over (subtract the value of k, multiplied by the number of times we printed it, j)

The rest of the function deals with the fact that 4 and 9 are written differently as special cases. Should be pretty clear, except for one thing: The return values, (y%9) and (y%4), use an operation called modulo. (Which gives the remainder of an integer division. For example, 17%5 = 2 because 17/5 = 3 and 17 - (3*5) = 2.) They will always be equal to 0, and writing them in this format is a little pointless.

So when we call romanise() repeatedly, each call will print a certain symbol a certain number of times, and let us know how much of the number remains to be printed. We feed that value into the next function call (it's important to note that since we write yr = romanise (...) on each line, the value of yr is changing at each step; it's always the remaining part of the number the user entered). We repeat until we're down to 1, and at that point the number is complete:

Hello! Does anybody know of any 3d modules working in the newer versions of AGS? At least 3.0 onwards. I tried easy-3D, to no avail. 3D-AGS seems to be missing some plugins. I don't even want something too complex; something like doom working on a few rooms is enough (I plan to use it for mini-games, not the whole game). Thanks in advance!