0 registered members (),
1,227
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Question for panels and Texts
[Re: Widi]
#301628
12/12/09 06:32
12/12/09 06:32
|
Joined: Mar 2007
Posts: 112
MikeS
OP
Member
|
OP
Member
Joined: Mar 2007
Posts: 112
|
|
|
|
Re: Question for panels and Texts
[Re: MikeS]
#301643
12/12/09 13:19
12/12/09 13:19
|
Joined: Mar 2007
Posts: 112
MikeS
OP
Member
|
OP
Member
Joined: Mar 2007
Posts: 112
|
ok, next question :-) I trie to store 4 variables in one skill. all variables contain 2 chars. i tried with this code:
function display_Armor_data_Front()
{
var Front_Armor_Max;
var Front_Armor_Actual;
var Front_Internals_Max;
var Front_Internal_Actual;
var temp_var1;
var temp_var2;
var my_selected_target;
my_selected_target = selected_target;
while (my_selected_target == Selected_target)
{
str_for_num(str_temp2,your.skill11);
str_trunc(str_temp2,7);
Front_Armor_Max = str_to_num(str_temp2);
str_for_num(str_temp2,your.skill11);
str_trunc(str_temp2,5);
str_clip(str_temp2,2);
Front_Armor_Actual = str_to_num(str_temp2);
str_for_num(str_temp2,your.skill11);
str_trunc(str_temp2,3);
str_clip(str_temp2,4);
Front_Internals_Max = str_to_num(str_temp2);
str_for_num(str_temp2,your.skill11);
str_clip(str_temp2,7);
Front_Internal_Actual = str_to_num(str_temp2);
str_for_num(str_my_selected_target_armor_front1,Front_Armor_Actual);
str_for_num(str_my_selected_target_armor_front,Front_Armor_Max);
str_cat(str_my_selected_target_armor_front,"/");
str_cat(str_my_selected_target_armor_front,str_my_selected_target_armor_front1);
wait (1);
}
}
ok, i defined the skill 11 with 876543.21 what i wanna display with this code is 87/65 what i get is 876/654 is anything wrong with this code?? i dont find it. Does anybody has an Idea for an maore elegant way to do this, or do i have to work with strings for this? Greetings Mike
|
|
|
Re: Question for panels and Texts
[Re: MikeS]
#301654
12/12/09 15:54
12/12/09 15:54
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
well the 1st question is, why not just use skill11 to skill14? 2ndly str_for_num generates strings with 3 decimals, so your string length (str_len if you wanna check this) is 10 3rdly, most str functions are slow or medium speed, so you don't really want to be doing this every frame, by the looks of what you have there i'd have
while (my_selected_target != Selected_target)
to only recalculate this once my_selected_target has changed finally, instead of doing all that, you could use skill11 to store a stuct, and save all the data in there that you need hope this helps
|
|
|
Re: Question for panels and Texts
[Re: MrGuest]
#301678
12/12/09 18:43
12/12/09 18:43
|
Joined: Mar 2007
Posts: 112
MikeS
OP
Member
|
OP
Member
Joined: Mar 2007
Posts: 112
|
ok, the answer for 1 is easy, there will be 9 more armor sections, which i need to control and display, so that would cost me roundabout 40 skills of 100, which is in my opinion too much, so the idea is to spare skills. ok, str_for_num creates 3 decimals, ok, now i see where the problem is. finally, instead of doing all that, you could use skill11 to store a stuct, and save all the data in there that you need ok, what is a stuct, what do you mean? i dont know that term. How could i use this? Maybe u can give me an example? Oh, and im using A6 com. Greetings, Mike
Last edited by MikeS; 12/12/09 18:45.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|