Posted By: MrCode
Usage of structs? - 08/03/07 05:55
I know what a struct is, I just don't know how I would use it in a script. Can someone point me in the right direction here?
Well, I did write this small test code to test my knowledge of the syntax:
Code:
but you could just as easily define the vars and display them with the panel.
EDIT: Oops! Sorry, wrong forum! I thought I was in Lite-C Scripting! Could someone move this?
Well, I did write this small test code to test my knowledge of the syntax:
Code:
#include <acknex.h>
#define PRAGMA_ZERO
var showint1;
var showint2;
typedef struct
{
int test1;
int test2;
char test3[10];
} TEST;
TEST* here_we_go=
{
test1= 7;
test2= 7;
test3= "Hello, World!";
}
FONT* sys_font= "Terminal#12";
PANEL* show_struct_values=
{
digits (320,240,"Struct value 1= %9.0f",sys_font,1,showint1);
digits (320,250,"Struct value 2= %9.0f",sys_font,1,showint2);
flags= visible;
}
void exit_()
{
sys_exit(NULL);
}
function main()
{
screen_color.red= 1;
video_mode= 8;
video_screen= 1;
on_esc= exit_;
showint1= here_we_go.test1;
showint2= here_we_go.test2;
}
but you could just as easily define the vars and display them with the panel.
EDIT: Oops! Sorry, wrong forum! I thought I was in Lite-C Scripting! Could someone move this?