Sign in to follow this  
chaore

[Help] Need to know what is wrong.

Recommended Posts

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.

 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this