Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Host app access to AS variables


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Rain Dog   Members   -  Reputation: 136

Like
0Likes
Like

Posted 11 September 2004 - 02:47 PM

I know it is possible to have the host application expose its variables to angelscript, but how would i expose angelscript variables to the host app?

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3220

Like
0Likes
Like

Posted 11 September 2004 - 03:12 PM

The engine interface provides the following methods for accessing globally declared script variables:


// Script global variables
virtual int GetGlobalVarCount(const char *module) = 0;
virtual int GetGlobalVarIDByIndex(const char *module, int index) = 0;
virtual int GetGlobalVarIDByName(const char *module, const char *name) = 0;
virtual int GetGlobalVarIDByDecl(const char *module, const char *decl) = 0;
virtual int GetGlobalVarDeclaration(int gvarID, char *buffer, int bufferSize) = 0;
virtual int GetGlobalVarName(int gvarID, char *buffer, int bufferSize) = 0;
virtual int GetGlobalVarPointer(int gvarID, void **pointer) = 0;



If you know the type and name of the variable you can get the id with GetGlobalVarIDByDecl() then use GetGlobalVarPointer() to get a pointer to the memory where the variable is located. If you don't know the variables or their types use the other methods for retrieving that info.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 Rain Dog   Members   -  Reputation: 136

Like
0Likes
Like

Posted 11 September 2004 - 06:45 PM

what if the variables are not globally declared?

And if that is not possible what kind of debugging information can be generated?

#4 Andreas Jonsson   Moderators   -  Reputation: 3220

Like
0Likes
Like

Posted 12 September 2004 - 03:16 AM

The host application doesn't have direct access to the script context stacks. It wouldn't be of much use anyway since the script doesn't store the type of the local variables on the stack.

The application can get information on where in the code the script execution is currently located at. There are functions for getting which module, function, and line that is being executed. The code can also be stepped through, line by line.

What exactly do you want to do? If you explain to me I might be able to help you. I might even be able to change AngelScript to include the feature you need if it doesn't have it already.


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

#5 Rain Dog   Members   -  Reputation: 136

Like
0Likes
Like

Posted 12 September 2004 - 03:17 PM

My intentions for angelscript are to be able to allow a person to write a script, and while the script is executing, have a real time display of a combination of user defined script variables and host app variables, and the display of which be designated by the user through a simple interface.

#6 Andreas Jonsson   Moderators   -  Reputation: 3220

Like
0Likes
Like

Posted 13 September 2004 - 01:42 AM

It's possible for me to give access to the stack used by a function, and even the list of functions called up until current execution point.

However, I can't give you information about what type of data is stored at each position in the stack, nor the name of the variable. This information simply isn't stored anywhere. Some positions even store more than one variable in the same functions (at different times though).

Maybe I could alter the library to store the name, type, and position of each variable used in the functions, and then allow the application to access this information. However, I'm afraid that I'll have to give this quite a low priority. If you wish to do the alteration yourself though, I might be able to include your changes in the main library code afterwards.


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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS