Jump to content
  • Advertisement

OmniGamer

Member
  • Content Count

    7
  • Joined

  • Last visited

Community Reputation

0 Neutral

About OmniGamer

  • Rank
    Newbie

Personal Information

  • Interests
    Programming

Social

  • Github
    fgRuslan
  1. OmniGamer

    Crash on preparing context

    ctx->Execute doesn't run without context being prepared
  2. void PlaySound(string &filename){ Music music; music.openFromFile(filename.c_str()); music.play(); } This code doesn't play music, but if I try to play music in main.cpp, everything is ok.
  3. OmniGamer

    Crash on preparing context

    My mistake was in the section of code where I registered the functions. I did it like this: r = engine->RegisterGlobalFunction("void PrintDebugString(string &in)", asFUNCTION(PrintDebugString), asCALL_CDECL); assert( r >= 0 ); And to fix this crash, I replaced void PrintDebugString(string &in) With void PrintDebugString(const string &in)
  4. OmniGamer

    Crash on preparing context

    Oh, never mind. Everything is okay, I just registered the function the wrong way.
  5. OmniGamer

    Crash on preparing context

    I use 2.32.0 version. I made no customizations to the library.
  6. OmniGamer

    Crash on preparing context

    asIScriptModule *mod = engine->GetModule("ScriptModule"); asIScriptFunction *func = mod->GetFunctionByDecl("void main()"); if( func == 0 ) { // The function couldn't be found. Instruct the script writer // to include the expected function in the script. printf("The script must have the function 'void main()'. Please add it and try again.\n"); return; } // Create our context, prepare it, and then execute asIScriptContext *ctx = engine->CreateContext(); ctx->Prepare(func); int r = ctx->Execute(); if( r != asEXECUTION_FINISHED ) { // The execution didn't complete as expected. Determine what happened. if( r == asEXECUTION_EXCEPTION ) { // An exception occurred, let the script writer know what happened so it can be corrected. printf("An exception '%s' occurred. Please correct the code and try again.\n", ctx->GetExceptionString()); } } When my program reaches ctx->Prepare(); the program crashes. Does anybody know how to fix it? If you need, I can give you the whole code.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!