Advertisement

New to angelscript

Started by August 06, 2006 10:15 AM
5 comments, last by Marianne 18 years, 3 months ago
Hi, i'm new to AngelScript... i am looking for a scripting language to embed into my C/C++ app. I'm mostly working on mac and linux. Unfortunately, almost all provided samples use "windows.h"... is there a minimal cross-platform sample? just to demonstrate how it works... thanks =) PS: i've seen the documentation on angelcode.com but i couldn't find any that creates a whole program. they all seem to focus on a specific part of the program and leave me with no clue of how to do a whole program
The windows.h header is usually only used for timeGetTime(), which returns the number of milliseconds since system start. Both Linux and Mac should have a similar function that you could use instead.

If you could tell me which it is, I could make the samples OS independent.

Also, the console sample doesn't use windows.h, so maybe that will work without any changes.

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
Yes, Console works. but, from it, i can't figure out how to make a simple angelcode script that uses objetcs/functions declared from C/C++... i guess i'll try working with the tutorial, but as i said i have absolutely no angelcode knowledge and fixing things you don't know about is sometimes a little hard =) But im sure i can do it... what i meant is that it would have been nice to have these simple samples, but if i don't have them i can still manage i believe

and conio.h isn't found either, i don't know what this is

EDIT: I Adapted the turorial example the best i can, but at linking i get these:

ld: warning prebinding disabled because of undefined symbols
ld: Undefined symbols:
PrepareSystemFunction(asCScriptFunction*, asSSystemFunctionInterface*, asCScriptEngine*)
CallSystemFunction(int, asCContext*, void*)

why aren't these functions there? libangelscript.a is linked

[Edited by - Marianne on August 6, 2006 1:22:05 PM]
The conio.h header is used to allow user input. There should be a suitable substitute on both Linux and Mac for that one as well.

The problem with the undefined symbols PrepareSystemFunction and CallSystemFunction is due to them being compiler specific. It would seem that you're using a compiler that is not yet automatically identified in as_config.h. You probably need to define the flag AS_MAX_PORTABILITY to get the library to compile correctly. This removes support for native calling conventions, but the library will be fully working on any platform.

What compiler are you using? What OS is it?

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

Right now i am using Mac OS X with gcc 3.3. I believe gcc is supported, right?

following the source code, i fell upon as_callfunc files... i tried adding them to my project so that they could be built properly, but got the following message:

script (1, 1) : INFO : Compiling double calc(double, double)
script (4, 24) : ERR : Found more than one matching operator
script (4, 28) : ERR : Found more than one matching operator
script (4, 35) : ERR : No conversion from '<unrecognized token>' to math type available.
../../source/as_compiler.cpp:6132: failed assertion `ctx->type.dataType.IsReference()'
Yes, gcc is supported.

Ok, so you have gotten the library to compile and you have managed to get your application up and running.

Now your problem seems to be that you're compiling an invalid script, that unfortunately triggered a bug in the library causing the assert failure. Can you show me the script you're trying to compile when you get this error? This will allow me to help you correct your script and also identify and fix the bug in the library.

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
Well, i got it to build but not the "right" way. CallSystemFunction wasn't defined in the archive, so i added the file defining it to my project. I'm not sure if this is a valid way of going.

And the code i'm using is the one from the tutorial example. (i removed the getSystemTime thing because i didn't implement a mac-os version of it. I just removed calls to it... could this be a problem? i thought it would just hang instead of timing out but maybe there's something i didn't think about)


float calc(float a, float b)
{
// Print the value that we received
Print("Received: " + a + ", " + b + "\n");

// Do the calculation and return the value to the application
return a * b;
}

This topic is closed to new replies.

Advertisement