🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Return values for 1.7.x

Started by
3 comments, last by EddHead 19 years, 9 months ago
I was trying to return a bool value to the host app from the script. here's my code..... ------------------ C++ CODE -------------------------------engine->GetFunctionIDByName("test"); Context->Execute(); DWORD j=0; Context->GetReturnValue( &j, 0 ); bool bState = (bool)j; ---------------------------------------------------------- ----------------- SCRIPT CODE ---------------------------- bool test() { OutputDebugMessage("test works!"); return true; } ---------------------------------------------------------- Is this right? cos I dont seem to be getting results even though i get a debug outputstring!
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.
Advertisement
Change it to

Context->GetReturnValue( &j, 1 );


and I believe it will work. You were telling the engine to copy 0 dwords to the j variable, which of course wouldn't work. [wink]

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

Oops! seems to be working now? is there anyway i could directly obtain values in the right data type since i think typecasting might be slower.
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.
You can probably do it like this:

bool bState;Context->GetReturnValue( (DWORD*)&bState, 1 );

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

Tried it.......Doesnt seem to work, the older method works though!
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.

This topic is closed to new replies.

Advertisement