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

961
Programming Help / Re: How do I use DLL inside ENIGMA?
« on: April 29, 2014, 07:51:22 pm »
Looks far too confusing and more complicated than just using scripts, how would I know how to edit the required files so that it "plugs" into LGM ?

Or I could simply make the custom C++ library accept arguments and pass them from my scripts in LGM through execute file or shellexec ?


962
Programming Help / How do I use DLL inside ENIGMA?
« on: April 29, 2014, 07:25:43 pm »
Can I use DLL libraries inside my projects ?
If so how do I do that ?

I am eventually thinking of making custom functions in C++ and make them as DLL and call them from GML.

Remember I was talking that I wanted to write a custom library to handle individual external resources
files where I can store encrypted levels, sounds, video, etc. etc. etc.  I could do that as scripts inside LGM, but I want to do those in C++ and create a DLL from it, and call the functions from GML.

Example function

Sound1=ExtResource("Sounds.res","intro.wav");

This would call the function I made in C++
which will handle all this automatically (calling an embedded index file in the res file and extract the right file).

If this can be done could someone guide me with
a very simple example?

Thanks.

ALSO if I use this method, according to the current license, do I also have to provide the source code for the DLL/ C++ ? or it is not necessary, only have to provide the EGM file ?



963
Programming Help / Re: How to do conditional branching in C++ ?
« on: April 29, 2014, 07:15:35 pm »
What about GOTO is there such a thing as a functional GOTO in C++ I heard that yes, but heard that people use it for complicated loops, is it bad practice to use it otherwise ?
Would I be complete laughing stock of the C++ community if I used

:startQ
(code to ask question) + conditionals

if criteria not met GOTO :startQ
thing ? 

If it's valid why not use it right ? :D  I remember using this in QBASIC, would this work in C++ ?


964
General ENIGMA / Re: Variable performance
« on: April 29, 2014, 07:09:20 pm »
I know that YYC yields better results than non-YYC. It's actually in the topic I linked to and I mentioned that it's more proper to compare ENIGMA to YYC.

I wonder how the YYC would compare to ENIGMA ?
Do you think ENIGMA's would still be faster than their YYC ?  If going by their track record I would think ENIGMA has the edge on speed :D

965
Programming Help / How to do conditional branching in C++ ?
« on: April 29, 2014, 05:33:50 pm »
Ok I am aware of the variable types, int, double, char, bool, etc, and the operators, if / then etc.

Here is the scenario:

Ask a person to enter a number from 1 to 100.
On the condition that a valid range is entered,
output "The number you entered is (insert number here)".
Otherwise output "Invalid entry - try again"
and it would proceed to asking the question again
until a valid entry is entered.

Now I would know how to build this, and to declare an int variable, I know how to use cout and cin,
brackets, int main(), namespace, includes, etc.
and I know how to check variables with if/then.

There are 2 ways to do this

1)  If the user does not input the correct range a message informs them that the entry is invalid and that the program is terminated.

2) The user is informed of an invalid range and is is informed to try again, where the same question will be asked ,for as long as the user enters the valid range.

How to do number 2 ????

In BASIC

10 PRINT"Enter a number from 1 to 100"
20 INPUT A
30 IF A < 1 OR A > 100 THEN PRINT "Invalid - try again":GOTO 10
40 PRINT"The number you entered is "A
50 END

In ASM you have JNE / JEQ  to jump back to the code.

What do you do in C++ ?


966
Programming Help / Re: How to declare variables in ENIGMA?
« on: April 29, 2014, 04:25:38 pm »
Ok, but I'm still pretty sure 4.5 integer would not make sense in any BASIC compiler that I know of, I think you're just remembering wrong.

Don't underestimate my memory :D  I have sharp memory.

Yes in BASIC I used INT and fraction numbers.

Here is an example, I used it a lot when generating random numbers.

A=INT(RND(0)*100)

BTW, in ENIGMA you can also use int(variable),
I tried it.

In C++ it would be (int)variable right ?



967
General ENIGMA / Re: Inheritance Fixes
« on: April 29, 2014, 04:13:27 pm »
I agree with Harri :)  I rarely if at all use inheritance and I agree it should be optional.

968
Issues Help Desk / Re: IDE tranparency flag issue
« on: April 29, 2014, 04:12:03 pm »
I think EGM should be the default formar. Or gmk (even though it doesn't support many options), because caveats in GMX can hurt new users.

Also, why can't you just create a folder when the user saves GMX? Like if the user types "mygame.gmx" you create a folder mygame (if it doesn't exist) and put everything in it? Or just show a pop-up for the user saying that it will write many discrete files to the selected folder.

Until this gets done automatically (sure it won't as they probably have way bigger fish to fry);
It's easy for anybody to create a folder during a save, simply save as and in a blank spot right click, create a new folder, double click it and save file in said folder, done.  :D


969
General ENIGMA / Re: Variable performance
« on: April 29, 2014, 04:09:24 pm »
Interesting, now in real world, does this matter ?  People judge the games by the overall frame rate.  Even under worst scenarios with tons of variables and such would probably not reduce game speed by something noticeable most people would perceive.

Also the YYC would probably yield better result compared to non YYC, as this is CPU operations, and the YYC benefits CPU and not GPU intensive games.  Also I would think that the memory speed can have an impact too, depending on people's configuration but again, we are talking very precise measurements that would not be noticeable in most cases, if at all.

I don't have YYC to test this :)


970
Programming Help / Re: How to declare variables in ENIGMA?
« on: April 29, 2014, 10:29:39 am »
If I am NOT going to be using negative, that would be signed

You've got that backwards. Signed means that the first bit is used to indicate a negative number rather than being a part of the value, making negative numbers possible. Unsigned means that all bits are used to indicate the value, which doubles[1] the maximum positive value at the cost of not being able to represent negative numbers.

Example: the char value 10001011 would be -117 if it's signed; since the first bit is 1, the rest of the bits indicate the positive distance from the smallest possible negative number (-128). Unsigned, it would instead be 139.

Usually integers are signed by default. Declaring variables as signed explicitly is not necessary, it just makes your intention more explicit, really.

Quote
Does it mean if I decrease a variable and i goes below 0 it will not be negative?

That might differ between implementations, but I wouldn't depend on this. I don't have a whole lot of experience with this, but my guess is at least some implementations would just set all bits to 1, which would be -1 if the variable is signed, but the maximum value of the variable if it's unsigned (e.g. 255 for a char). Instead of expecting the C++ implementation to deal with unsigned integers differently from signed integers, I would take making sure values stay within a particular range into my own hands.

[1] Actually, it's doubled plus 1.

So for unsigned it would be something like

int unsigned myvar;

right ?

if not using anything such as

int myvar;

it would be by default signed ?


971
Programming Help / Re: How to declare variables in ENIGMA?
« on: April 29, 2014, 10:27:15 am »
By the way sorry Darkstar2 for 'polluting' your topic  :D

It's ok, it's about variables after all :D

972
Programming Help / Re: How to declare variables in ENIGMA?
« on: April 29, 2014, 03:56:52 am »
Another question, signed and unsigned.   Now I know what they are, but how do I need to declare a variable as signed or unsigned ?

If I am NOT going to be using negative, that would be signed, do I have to specify it ? Does it mean if I decrease a variable and i goes below 0 it will not be negative?

If on the other hand I want to use negatives, do I have to declare unsigned?

Thanks.


973
Programming Help / Re: How to declare variables in ENIGMA?
« on: April 29, 2014, 03:00:39 am »
I think there is problems with global variables right now. In an empty project, just try to create a script with this line inside :

Code: [Select]
global myvar = 10;
I took this simple example from http://enigma-dev.org/docs/Wiki/Global

You will have the following error message:

Quote
In file included from SHELLmain.cpp:102:0:
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h: In function 'variant _SCR_scr_0(variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant, variant)':
C:/ProgramData/ENIGMA/Preprocessor_Environment_Editable/IDE_EDIT_objectfunctionality.h:35:32: error: 'globalmself' was not declared in this scope
     enigma::varaccess_yvar(int(globalmself))= 10;

If you declare instead

Code: [Select]
global var myvar = 10;
You don't have anymore the error message. But if i try to display the value in an object :

Code: [Select]
show_message(string(myvar));
It displays nothing.

It displays nothing because it shouldn't :D because you are not calling the script, so how is it going to know ? :P things in scripts don't automatically get executed, they have to be called. :) 

In your case you are right if you don't declare type, you get the message error, however, using declared I got it to work with your example.

scr_0 (script)

global var myvar=10;

(you can use var, int, bool, etc.) in this example I would have personally used global int myvar=10, but anyway.

obj_0 (create event)

scr_0();   (this calls the script, you need to do this :D)
show_message(string(myvar));

When I run it displays a 10.  So it works.

If you don't call the script, it won't display anything, that's how scripts are supposed to work :)

In your example you would not even need a script if it's not used, so you would place the global int myvar=10 into your object and not in a script.

BTW Robert, I figured out what I was doing wrong, sort of. :)

Seems global do work after all.


974
Programming Help / Re: How to declare variables in ENIGMA?
« on: April 29, 2014, 01:50:52 am »
Ok, but I'm still pretty sure 4.5 integer would not make sense in any BASIC compiler that I know of, I think you're just remembering wrong.

But yeah, I also tested exactly what you had without me adding a colon, and it still worked fine and showed me the number 4.
Code: (EDL) [Select]
int a
a=4.50
show_message(string(a));
and for global a would I do this

int global a
a=4.50

or
int global a
global.a=4.50

975
Programming Help / Re: How to declare variables in ENIGMA?
« on: April 29, 2014, 01:37:11 am »
Thanks will check that later today !

BTW yes I know the difference between int and float, I used INT when I did BASIC.  :)

for some strange reason it did not work for me in LGM, maybe I did something wrong, seems to be the norm :D :D :D

Anyhow.