Advertisement

[Help] Need to know what is wrong.

Started by July 30, 2013 04:34 AM
1 comment, last by chaore 11 years, 3 months ago

HI,

Before starting to explain my problem, I want to excuse myself for the poor quality of my text, English is not my primary language. Secondly, I want to say a big thank you for this awesome scripting language.

I have a small problem with byte code loading, the LoadByteCode function is returning me -1 when my function have some lines of code.

The example that I made is made like this; If main.as exist, it compile the text and create a bin.asc that is the script in byte code and it runs the script. If the main.as doesn't exist, it reads the byte code. So if you want to compile, name your script file main.as and to run the programme, and for testing the byte code delete the main.as.

So here is the code that is reproducing my problem, I tried to reduce it as I can and the code quality is very poor: http://pastebin.com/v425HHaJ

So the problem is this. When I use this code with a script simple as this:

//as script

void main()
{
print(900);
}
I have no problem, the compiled code is working like expected.
But if I do a code with more content like this one:
//as script
void main()
{
print(900);
print(800);
print(90);
print(897);
print(98908);
print(989000);
print(878);
print(900);
print(89099);
print(900);
print(900);
print(890890);
print(900);
print(900);
print(90000);
print(90000);
print(90000);
print(90000);
print(90000);
print(90000);
print(90000);
print(90000);
print(90000);
print(90000);
print(90000);
print(90000);
}
The text code is working, it's compiling well, but when I delete the main.as to run the byte code, LoadByteCode from the asIScriptModule return me -1.
So thank you for your help, I hope this fast-written code will not give your some diseases.
Chaore.
PS: I am using AngelScript 2.27.0.

Are you working on a Windows platform? If so you need to open the file in binary mode, i.e. fopen("bin.asc", "w+b") and fopen("bin.asc", "r+b"), otherwise bytes may be modified as Windows translates line break characters.

Let me know if that doesn't solve your problem and I'll investigate this closer.

Regards,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

Yeah I am on windows and it's now working, big thank you !

This topic is closed to new replies.

Advertisement