2 registered members (TipmyPip, 1 invisible),
18,731
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
digits/windows with vars from ext. language
#67682
03/22/06 12:41
03/22/06 12:41
|
Joined: May 2005
Posts: 338 Brasil
Filipe
OP
Senior Member
|
OP
Senior Member
Joined: May 2005
Posts: 338
Brasil
|
Good morning, all. I know that when i create a panel using pan_create, i can put digits or windows on it through an script string, like this Code:
pan_create("digits 122, 56, clip_ammo_frmt_str, clip_ammo_font, 1, ammo;", _VAR(3));
this way, i need the variable, the string and the font to be defined in a wdl script, then i have to get a pointer to that using engine_getobj so i can change it. If I was to make everything in c++ (because i'm doing everything object-oriented and i don't want to mix it up with scripts), how would it be possible to make a digit show a variable not defined in c-script, but defined in c++? like Code:
var l_varMyAmmo; STRING l_strFormat; FONT l_fontMyFont; ... pan_create("digits 122, 56, (l_strFormat)?, (l_fontMyFont)?, 1, (l_varMyAmmo)?;", _VAR(3));
How will that work when i use the acknex.dll instead of the .exe (no script)? thanks, Filipe
|
|
|
Re: digits/windows with vars from ext. language
[Re: Filipe]
#67683
03/22/06 13:08
03/22/06 13:08
|
Joined: Aug 2005
Posts: 1,230
MichaelGale
Serious User
|
Serious User
Joined: Aug 2005
Posts: 1,230
|
Create a panel with digits and attach variables you gave in a wdl, then you write a function in C++ which you call everytime if you wish to update the values, something like that: Code:
var test;
function refresh_var() { DLL_RefreshVar(); }
The DLLFunction gets the var from the script with engine_getobj() and then you can manipulate it. regards
Your friendly mod is at your service.
|
|
|
Re: digits/windows with vars from ext. language
[Re: MichaelGale]
#67684
03/22/06 13:42
03/22/06 13:42
|
Joined: May 2005
Posts: 338 Brasil
Filipe
OP
Senior Member
|
OP
Senior Member
Joined: May 2005
Posts: 338
Brasil
|
thanks, kohji, but actually i want to do exactly the opposite of that  ... like i said, i'm trying to do everything in c++ with no c-script, cause i don't want to mix object oriented programming with c-script. so, the problem is not updating the var inside the dll, is defining it inside the dll. i think there's actually no way to do it, but i know that in the near future i'll be able to use the engine as a dll, and in that case i'd use no c-script at all. so there must be a way to make digits and windows without c-script, if not implemented yet, at least planned for the future... but thanks anyway.
|
|
|
Re: digits/windows with vars from ext. language
[Re: Filipe]
#67685
03/22/06 14:54
03/22/06 14:54
|
Joined: Aug 2005
Posts: 1,230
MichaelGale
Serious User
|
Serious User
Joined: Aug 2005
Posts: 1,230
|
You can try this, but I dpn't know for sure, wheter it works like you want: Code:
void createapanel() { var ammo = 30; STRING ammo_string; FONT ammp_font;
pan_create("digits 122, 56, ammo_string, ammo_font, 1, ammo;", _VAR(3)); }
If it doesn't work, there is no way to handle this with C++ I think. Good luck 
Your friendly mod is at your service.
|
|
|
Re: digits/windows with vars from ext. language
[Re: Filipe]
#67687
03/22/06 15:15
03/22/06 15:15
|
Joined: Aug 2005
Posts: 1,230
MichaelGale
Serious User
|
Serious User
Joined: Aug 2005
Posts: 1,230
|
If you're creating a DLL for GS you've to use C-Script however and I don't think that is what you want  I'm currently working on a project in which I try to handle as many as possible with C++, but everything isn't possible ... regards
Your friendly mod is at your service.
|
|
|
Re: digits/windows with vars from ext. language
[Re: MichaelGale]
#67688
03/22/06 19:26
03/22/06 19:26
|
Joined: May 2005
Posts: 338 Brasil
Filipe
OP
Senior Member
|
OP
Senior Member
Joined: May 2005
Posts: 338
Brasil
|
ok, i realized there is a way to set the variables for the digits, using the digits_set instruction. like this: Code:
var m_varClipAmmo; var m_varTotalAmmo; PANEL* m_panAmmo; ... m_panAmmo = pan_create("digits 122, 56, clip_ammo_frmt_str, clip_ammo_font, 1, 0; digits 118, 68, total_ammo_frmt_str, total_ammo_font, 1, 0;", _VAR(3)); digits_set(m_panAmmo, _VAR(1), &m_varClipAmmo); digits_set(m_panAmmo, _VAR(2), &m_varTotalAmmo);
but what about the format string and the font? and what about windows definitions? how do i set the variables and the bmap in there without having to define them in c-script? anyone has any ideas? Thanks again, Filipe Edit: and for buttons? 
Last edited by Filipe; 03/22/06 21:20.
|
|
|
Re: digits/windows with vars from ext. language
[Re: jcl]
#67690
03/23/06 12:28
03/23/06 12:28
|
Joined: May 2005
Posts: 338 Brasil
Filipe
OP
Senior Member
|
OP
Senior Member
Joined: May 2005
Posts: 338
Brasil
|
|
|
|
|