0 registered members (),
1,459
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Changing Strings at runtime
[Re: Toryno]
#290813
09/21/09 15:30
09/21/09 15:30
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
Serious User
|
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
You can use the pstring array together with str_cpy...
str_cpy((my_text.pstring)[7], "Hello"); // Set 8th string to "Hello"
The 7 in the [] is the index of the string to edit, in this case it would edit the 8th string (indexes start with 0).
Last edited by DJBMASTER; 09/21/09 15:30.
|
|
|
Re: Changing Strings at runtime
[Re: Quad]
#290829
09/21/09 17:20
09/21/09 17:20
|
Joined: Apr 2009
Posts: 138 Germany
Toryno
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 138
Germany
|
Aha, so that's the same =D But it still don't want to work correctly, when the function chose_target is called, you can't see the digits no more. Why?
PANEL* targets =
{
layer = 5;
button = 0,0, cg_released_pcx, cg_normal_pcx, cg_over_pcx,chose_target,NULL,NULL;
digits = 2,2, "target: first", "Arial#24", 0, 0;
}
void chose_target() {
pan_setdigits(targets,1,2,2, "target: last", "Arial#24", 0, 0);
}
Thanks for reading, thinking, answering
|
|
|
Re: Changing Strings at runtime
[Re: Toryno]
#290865
09/21/09 23:23
09/21/09 23:23
|
Joined: Aug 2003
Posts: 63 UK
ptrc1c
Junior Member
|
Junior Member
Joined: Aug 2003
Posts: 63
UK
|
Hi Toryno, I have found a way to do this //////////////////////////////////////////////////////////////////// #include <acknex.h> #include <default.c>
////////////////////////////////////////////////////////////////////
STRING* temp_text ="pete";
var* tee; tee = 3; function main() { video_mode = 7; screen_color.blue = 150; mouse_mode = 4; }
//////////////////////////////////////////////////////////////////////
PANEL* main_pan = { bmap = "main.pcx"; pos_x = 250; pos_y = 200; button (250, 134, "quitclicked.pcx", "quitnormal.pcx", "quitover.pcx", quit_program, NULL, NULL); digits (200,100, "%s",*,1,temp_text); flags = OVERLAY | VISIBLE; }
function quit_program() {
str_cpy(temp_text,"Its changed");
}
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|