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.


Messages - ojars

Pages: 1 2 »
1
Thank you, this works.

2
Issues Help Desk / Error Unknown function or script `audio_play_sound'
« on: August 27, 2019, 03:31:21 PM »
Hi all, I got an error Unknown function or script `audio_play_sound' in my game. After that I created new game with only create event and that function and another .wav file and got the same error.
Quote
Event[0, 0] Check `o_game::create...Syntax error in object `o_game', Create event:0:
Line 1, position 18 (absolute 17): Unknown function or script `audio_play_sound'

In the Game settings Platform is Windows, Graphics was set to Direct3D 11.0 and Audio to DirectSound. After the error I switched Gaphics to OpenGL 3.3 and Audio to OpenAl, and got another error
Quote
D:/Programmas/MSYS2/mingw32/bin/../lib/gcc/i686-w64-mingw32/7.4.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lmodplug
collect2.exe: error: ld returned 1 exit status
make[1]: *** [Makefile:139: compile_game] Error 1
make[1]: Leaving directory '/d/Programmas/ENIGMA/enigma-dev/ENIGMAsystem/SHELL'
make: *** [Makefile:20: Game] Error 2
Where is my mistake?

3
Issues Help Desk / Re: Can't configure enigma in ubuntu
« on: June 26, 2019, 11:49:45 AM »
Thank you. I'l try this.

4
Issues Help Desk / Can't configure enigma in ubuntu
« on: June 25, 2019, 02:51:53 AM »
Hi. I decided to install ubuntu alongside windows 8.1. All is OK, only I got an error when loaded lateralgm.
Quote
ojars@ojars-darba:~/enigma-dev$ ./start.sh
Java Version: 110003 (11.0.3)
Gtk-Message: 10:35:39.809: Failed to load module "canberra-gtk-module"
Loading lib files in /home/ojars/enigma-dev/lateralgm.jar
01_move.lgl 02_main1.lgl 03_main2.lgl 04_control.lgl
 05_score.lgl 06_extra.lgl 07_draw.lgl
I downloaded enigma.jar file and copied into enigma-dev folder.
Lateralgm starts and and the window opens, and i can create new application, but there are not compiler icons.
How to fix this? This is my first experience with ubuntu, and I don't know many basic things.

5
Programming Help / Re: How to access arrays stored in a ds_list ?
« on: June 10, 2019, 03:10:41 PM »
I do believe, that data structures are fast.
I wonder why it's not possible to use struct member functions. As I wrote in my previous post, when I tried to use member function, I got an error
Quote
Event[8, 0] Check `o_game::draw...Syntax error in object `o_game', Draw event:0:
Line 24, position 30 (absolute 770): Unknown function or script `get_area'

I consider to use structs as lightweight objects that don't move.

6
Issues Help Desk / Re: Error implementing struct
« on: June 10, 2019, 02:04:51 PM »
Eventually I found a right way how to implement structs: declaration should be done in Definitions, initialization should be done in Initialization and no need to create instance on the heap, simply put
Code: [Select]
circle test;and the code works. Unfortunately, ENIGMA cannot recognize inline function get_area(). When I tried to calculate area with a function, I got an error
Quote
  Event[8, 0] Check `o_game::draw...Syntax error in object `o_game', Draw event:0:
Line 24, position 30 (absolute 768): Unknown function or script `get_area'

At least now I can use struct for lightweight objects, I believe it is more convenient than data structures;


7
Programming Help / Re: How to access arrays stored in a ds_list ?
« on: June 10, 2019, 09:28:53 AM »
Yes, I can use lists exclusively. I wonder why I didn't imagine that sooner... lists stored into list...  Anyway thank you.

EDITED.
As I wrote in my post https://enigma-dev.org/forums/index.php?topic=2992.0, I just found a way how to implement structs. I even managed to store struct into list and access it. circle is a struct
Code: [Select]
str = ds_list_create();
circle.x = 300;
circle.y = 400;
ds_list_add(str, circle);
That code was in o_game create event, and this is in a Draw event:
Code: [Select]
var data = ds_list_find_value(str, 0);
draw_text(data.x, data.y, string(data.x));
and the result was seen on the screen, as expected - 300;



8
Programming Help / Re: How to access arrays stored in a ds_list ?
« on: June 10, 2019, 08:29:04 AM »
Well, I could use this, but arr must be local, so it terminates when the program leaves event or script. List have to contain an array as such, not individual array entries. List may contain tens of arrays and is created dynamically. I use such a lists for lightweight objects.
Where is that code located, perhaps I could have a look at that?

9
Programming Help / Re: How to access arrays stored in a ds_list ?
« on: June 10, 2019, 08:06:44 AM »
Thank you both! I'll be waiting and I''ll be patient...and let me know.

10
Programming Help / How to access arrays stored in a ds_list ?
« on: June 10, 2019, 05:22:01 AM »
Hi!
I wrote a simple test program. In a o_game create event
Code: [Select]
var arr[3];// = array_create(3);
arr[2] = 52;
arr[1] = 4;
arr[0] = 16
list = ds_list_create();
ds_list_add(list, arr);
then in a o_game draw event
Code: [Select]
draw_set_color(c_black);
draw_set_font(font_0);

var arr = ds_list_find_value(list, 0);// expected to get an array
draw_text(200, 200, "list size = " + string(ds_list_size(list)));
draw_text(200, 220, "array length = " + string(array_length_1d(arr)));
for (var n = 0; n < array_length_1d(arr); n++)
draw_text(100, 100 + n * 20, string(arr[n]));

The only thing I got was:
list size = 1
array length = 0
Perhaps I'm doing something wrong? Is there a way to get access to arrays stored in ds_list?

11
Issues Help Desk / Re: Error implementing struct
« on: June 01, 2019, 04:55:20 AM »
Thanks, I'l be patient.

12
Issues Help Desk / Error implementing struct
« on: May 31, 2019, 06:50:41 AM »
Hi!
I got an error, when tried to implement a struct into my code. I followed an example from https://enigma-dev.org/forums/index.php?topic=2674.msg25861#msg25861, where this example worked on Goombert's computer. In Definitions I created a struct
Code: [Select]
struct circle {
  var x = 0, y = 0;
  double radius;
  double get_area() { return pi * radius * radius; } // Simple method
  circle(double r = 1) { radius = r; }; // Optimizing this falls on the language plugin
  ~circle() { }
};

Script
Code: [Select]
///test_circle()

circle *test = new circle();
test.x = 200;
show_message(string(test.x));

In the o_game Create event
Code: [Select]
test_circle();
And in the Cleanup
Code: [Select]
delete test;
This is an error:
Syntax error in script `test_circle'
Line 3, position 26 (absolute 45): Unknown function or script `circle'

Then I put the code from script directly into the create event and the error is the same:
Event[0, 0] Check `o_game::create...Syntax error in object `o_game', Create event:0:
Line 4, position 26 (absolute 64): Unknown function or script `circle'

What's wrong in my code?

13
Programming Help / Re: Error with bitmask operations
« on: May 30, 2019, 07:43:13 AM »
Thanks, with casting to uint code works. But there is another problem.  I have code
Code: [Select]
///create_collision_map(col_map, w, h)
/*
constants: blocks
    EMPTY      = 0
    BLOCK      = 1
    LADDER     = 2
    LADDER_TOP = 4
    LADDER_WAT = 8
    WATER      = 16
    ACID       = 32
    GATE       = 64
    LAMP       = 128   
*/

var map = argument0;
var w = argument1;
var h = argument2;

for (var j = 0; j < h; j++) {
    for (var i = w - 1; i > -1; i--) {
      map[@ j, i] = 0;//error
    }
}

var xpos, ypos, t, xx, yy, left, xpos;//, top, ypos, ind;
var bgw = background_get_width(col_tiles) >> 6;
//store all tiles in the array
for (ypos = 0; ypos < room_height; ypos += BL_SIZE) {
    for (xpos = 0; xpos < room_width; xpos += BL_SIZE) {       
        t = tile_layer_find(0, xpos, ypos);       
        if (t > 0) {
            left = tile_get_left(t) >> 6;
            switch(left) {
                case 1: map[@ ypos >> 6, xpos >> 6] = BLOCK;      break;
                case 2: map[@ ypos >> 6, xpos >> 6] = LADDER;     break;
                case 3: map[@ ypos >> 6, xpos >> 6] = LADDER_TOP; break;
                case 4: map[@ ypos >> 6, xpos >> 6] = LADDER_WAT; break;
                case 5: map[@ ypos >> 6, xpos >> 6] = WATER;      break;
                case 6: map[@ ypos >> 6, xpos >> 6] = ACID;       break;
                case 7: {
                    var lamp = array_create(5);
                    lamp[L.x] = xpos;
                    lamp[L.y] = ypos;
                    lamp[L.spr] = get_lamp_sprite();
                    lamp[L.frm] = 0;
                    lamp[L.spd] = random_range(0.05, 0.2);
                    ds_list_add(g.lamplist, lamp);
                }
                    break;
            }
        }//if t
    }//for xpos
}//for ypos

tile_layer_delete(0);

}

And there is an error:
Syntax error in script 'create_collision_map'
Line 19, position 13(absolute 386): Unexpected symbol '@': unknown to compiler

If I understand right, ENIGMA does not allow GML acessors for arrays, lists and so on.

14
Programming Help / Error with bitmask operations
« on: May 29, 2019, 11:56:03 PM »
Hi!
In platformers for a collision checking with obstacles I don't use objects, instead, I create a collision map and use bitmask operations, for example:
if (get_block(x, y + 1) &  (BLOCK | LADDER_TOP))) 
   y = (y&$ffffffe0)+32;
where BLOCK and LADDER_TOP are constants (macros) and get_block() is a script.
In GM this works nice, but in ENIGMA I got an error: C:/Users/User/AppData/Local/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:367:13: error: invalid operands of types 'cs_scalar' {aka 'double'} and 'unsigned int' to binary 'operator&'
  367 |       y =(y & 0xffffffe0)+ 32;
      |           ~ ^ ~~~~~~~~~~
      |           |   |
      |           |   unsigned int
      |           cs_scalar {aka double} 

What is the right way to write such expressions?

15
Issues Help Desk / Re: fatal error: ffi.h: No such file
« on: May 29, 2019, 10:11:41 AM »
Thanks for replays. Just fixed and all is OK.

Pages: 1 2 »