Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


- - - - -

[Help] Need to know what is wrong.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 chaore   Members   -  Reputation: 109

Like
0Likes
Like

Posted 29 July 2013 - 10:34 PM

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.

 

 



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3453

Like
1Likes
Like

Posted 30 July 2013 - 07:12 AM

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

#3 chaore   Members   -  Reputation: 109

Like
0Likes
Like

Posted 30 July 2013 - 09:53 AM

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






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS