🎉 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!

write to memory address..need help..

Started by
3 comments, last by WitchLord 16 years, 8 months ago
hi..noob newbie here ;-) I found in the api reference the asIBinaryStream but I don't know how to use it... I want to do this.. I have an address (I.E. 0x12345678 ) that store a floating point value..In my app,when a key is pressed,it should change the value in that address.. what's the right syntax to use ?? ( please use the example address as a reference..I'm italian..I need clear things :-P ) if you need other informations....I'm using an 3d engine that use angelscript..I need to modify the friction of an object according to the torque provided to make a realistic behaviour cause the friction in this engine can only be set once and cannot be altered in any other way..while (in the reality) the friction changes according to many factors(speed,degrees angles of the object and so on...) ..that's all ;-) another question...is it possible that the script that will alter the address value realtime could crash the app ?? Best Regards - the noob :-P
Advertisement
The asIBinaryStream interface is not what you want. That is used for storing/restoring compiled bytecode.


If you want the script to be able to modify the value of the friction variable, then you'll have to register the friction variable as a property with the engine. Example:

// Register the address as a global property to give access to itfloat *ref = 0x12345678; // See, I'm using your address ;)engine->RegisterGlobalProperty("float friction", ref);// Now the script can access the property, just // as any other global variable in the scriptengine->ExecuteScript(0, "friction = 3.141592f");



The script shouldn't be able to crash the application just by interacting with the variable. Though, who knows what happens if you set the friction to a negative value? ;)

May I ask what 3D engine you're using?

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

Quote: Original post by WitchLord
The asIBinaryStream interface is not what you want. That is used for storing/restoring compiled bytecode.


If you want the script to be able to modify the value of the friction variable, then you'll have to register the friction variable as a property with the engine. Example:

// Register the address as a global property to give access to itfloat *ref = 0x12345678; // See, I'm using your address ;)engine->RegisterGlobalProperty("float friction", ref);// Now the script can access the property, just // as any other global variable in the scriptengine->ExecuteScript(0, "friction = 3.141592f");



The script shouldn't be able to crash the application just by interacting with the variable. Though, who knows what happens if you set the friction to a negative value? ;)

May I ask what 3D engine you're using?

Regards,
Andreas



Thanx a LOT Andreas :-P but I've tried it with the engine and it don't works...maybe I've made some errors...may you give that engine a watch?
I'm using 3D Rad 6.15 ;-)

Best Regards :-P

hey...did you found anything interesting ?? I need an answer...I don't want to wait for something that I just CAN'T do now...please..gimme an help..
Hi,

From what I can understand on the 3D Rad site, it is a closed source engine which only gives you a bit of freedom with the scripts. I don't think it exposes enough of the engine internals to the script engine to allow you to do what you want.

I suggest you talk to the authors of 3D Rad to see if they can help you. Maybe they can add support for what you want in their next release.

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

This topic is closed to new replies.

Advertisement