Sign in to follow this  
liadon666

write to memory address..need help..

Recommended Posts

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

Share this post


Link to post
Share on other sites
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 it
float *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 script
engine->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

Share this post


Link to post
Share on other sites
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 it
float *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 script
engine->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

Share this post


Link to post
Share on other sites
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..

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this