Pages: [1]
Author Topic: Function essentially asking for 1.5 arguments?  (Read 298 times)
Offline (Unknown gender) TacoBot
Posted on: September 27, 2016, 12:46:52 PM
Joined: Feb 2015
Posts: 15

View Profile
So here's the code in question:

Code: [Select]
image_speed = 0.1;
moveSpeed = 3;

weapon = "pistol";
facing = "down";

key_moveUp = keyboard_check(ord('W'));
key_moveDown = keyboard_check(ord('S'));
key_moveLeft = keyboard_check(ord('A'));
key_moveRight = keyboard_check(ord('D'));

key_shootUp = keyboard_check(ord('I'));
key_shootDown = keyboard_check(ord('K'));
key_shootLeft = keyboard_check(ord('J'));
key_shootRight = keyboard_check(ord('L'));

And if I compile that, I get the error:

Code: [Select]
Check `obj_player::create...Syntax error in object `obj_player', Create event:0:
Line 7, position 36 (absolute 114): Too few arguments to function `ord': provided 1, required 2.

Now, not only am I 100% sure ord() should take one (and only one) argument, but if I add an additional argument to the function:

Code: [Select]
In file included from SHELLmain.cpp:109:0:
/home/taco/.enigma/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In member function ‘virtual variant enigma::OBJ_obj_player::myevent_create()’:
/home/taco/.enigma/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:46:45: error: too many arguments to function ‘int enigma_user::ord(std::__cxx11::string)’
     key_moveUp = keyboard_check(ord("W", "W"));

I'm using the latest version off of Github, and I'm quite confused and frustrated. A little help?
Offline (Male) Goombert
Reply #1 Posted on: September 27, 2016, 05:27:05 PM

Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2988

View Profile
First, I can not reproduce this on the latest master version on Windows 10 with the above code. This must be specific to Linux and may be more of our string problems.

Don't be confused, the issue is actually very simple. So recently I noticed min/max argument counts was incorrect in the syntax checker. Believe it or not, I actually did fix it.
The reason it now appears broke in this case is due to our incompatibilities with C++11 strings. Because ord actually takes std::string in ENIGMA it is causing issues.

To work around this until I figure out more about your problem, you can go into the following file and set the variable to 0 instead of SIZE_MAX. Then save the file and reopen ENIGMA. However, after this the minimum argument count will be screwed up for other functions, but it will at least let you compile.
« Last Edit: September 27, 2016, 05:29:51 PM by Goombert » Logged
Welcome to ENIGMO, the game engine built by fucking aliens.

Pages: [1]