FOnline Development > General Discussion

Auto-aim

<< < (2/3) > >>

Plech:
now i got this.


--- Code: ---#include "_client_defines.fos"
#include "client_gui_h.fos"
#include "_colors.fos"
#include "_macros.fos"

uint8 autoAim = HIT_LOCATION_UNCALLED;
IGUIElementOpt@ AutoAimText;

void InitAutoAim()
{
    TestScreenButton2 buttonAction;
    @AutoAimText = GUI_AddScreenElement( CLIENT_MAIN_SCREEN_GAME, "ageoff.frm", 150, 50 )
    .CallbackMouseClick( buttonAction )
    .DownPic( "ageon.frm" )
    .Text( "Aim: N", FONT_FALLOUT, COLOR_DGREEN, COLOR_DRED, FT_CENTERX | FT_CENTERY | FT_NOBREAK );
}

class TestScreenButton2 : IGUIElementCallbackMouseClick
{
    void OnMouseClick(int click) override
{

autoAim = (autoAim + 1) % (HIT_LOCATION_GROIN + 1);

CritterCl@ chosen = GetChosen();
if(!valid(chosen))
return;

ItemCl@ item = chosen.GetItem(0, SLOT_HAND1);
if(valid(item))
{
int use = _WeaponModeUse(item.Mode);
int aim = _WeaponModeAim(item.Mode);
if(use != 0 || (aim != HIT_LOCATION_NONE && aim != HIT_LOCATION_UNCALLED))
{
AutoAimText.Text( "Aim:none", FONT_FALLOUT, COLOR_DGREEN, COLOR_DRED , FT_CENTERX | FT_CENTERY | FT_NOBREAK);
return;
}
}


string text = "";
switch(autoAim)
{
case HIT_LOCATION_EYES:
text = "Aim: E";
break;
case HIT_LOCATION_HEAD:
text = "Aim: H";
break;
case HIT_LOCATION_TORSO:
text = "Aim: T";
break;
case HIT_LOCATION_LEFT_ARM:
text = "Aim: LA";
break;
case HIT_LOCATION_RIGHT_ARM:
text = "Aim: RA";
break;
case HIT_LOCATION_LEFT_LEG:
text = "Aim: LL";
break;
case HIT_LOCATION_RIGHT_LEG:
text = "Aim: RL";
break;
case HIT_LOCATION_GROIN:
text = "Aim: G";
break;
}

AutoAimText.Text( text, FONT_FALLOUT, COLOR_DGREEN, COLOR_DRED, FT_CENTERX | FT_CENTERY | FT_NOBREAK);
}
}

uint8 GetAutoAim(){ return autoAim;}



--- End code ---
it works, only not changing the text of button after clicking. it will change the text only after relog.

wladimiiir:
I am sorry, I forgot to mention that I am using Client Gui Mod v0.4b.

Could not find zip file of this mod but here are my local files that you need:
Download link

After copying them to scripts folder, revert your changes to original auto_aim.fos.

Let me know, if you have any troubles with that. ;)

Plech:
its for revisin 252. im using 388.



--- Code: ---[02:52:319] Script message: client_gui : Info : Compiling void GUI_Init() : 2735, 1.
[02:52:319] Script message: client_gui : Error : 'DIK_NUMPADEQUALS' is not declared : 2841, 10.
[02:52:319] Script message: client_gui : Error : 'DIK_NUMPADCOMMA' is not declared : 2842, 10.
[02:52:351] Script::LoadScript - Unable to Build module<client_gui>, result<-1>.
[02:52:351] FOServer::ReloadClientScripts - Unable to load client script<client_gui>.
[02:52:624] Script message: client_screen_test : Error : Missing implementation of 'void IGUIElementCallbackMouseClick::OnMouseClick(int, int)' : 354, 7.
[02:52:624] Script message: client_screen_test : Error : Missing implementation of 'void IGUIElementCallbackMouseClick::OnMouseClick(int, int)' : 363, 7.
[02:52:624] Script message: client_screen_test : Error : Missing implementation of 'void IGUIElementCallbackMouseClick::OnMouseClick(int, int)' : 371, 7.
[02:52:624] Script message: client_screen_test : Error : Missing implementation of 'void IGUIElementCallbackInit::OnInit(int)' : 379, 7.
[02:52:624] Script message: client_screen_test : Error : Missing implementation of 'bool IGUIElementCallbackKeyPress::OnKeyPress(uint8, uint8)' : 379, 7.
[02:52:626] Script message: client_screen_test : Info : Compiling void TestScreen::OnMove(int, int) : 392, 2.
[02:52:626] Script message: client_screen_test : Error : No matching signatures to 'IGUIScreenOpt::GetPosX()' : 395, 37.
[02:52:626] Script message: client_screen_test : Error : No matching signatures to 'IGUIScreenOpt::GetPosY()' : 395, 66.
[02:52:629] Script message: client_screen_test : Info : Compiling void InitTestScreen() : 414, 1.
[02:52:629] Script message: client_screen_test : Error : No matching signatures to 'GUI_AddScreenElement(const uint, string@&, const uint, const uint)' : 417, 2.
[02:52:629] Script message: client_screen_test : Info : Candidates are: : 417, 2.
[02:52:629] Script message: client_screen_test : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 417, 2.
[02:52:629] Script message: client_screen_test : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 417, 2.
[02:52:629] Script message: client_screen_test : Error : Illegal operation on 'const int' : 418, 2.
[02:52:629] Script message: client_screen_test : Error : No matching signatures to 'GUI_AddScreenElement(const uint, string@&, const uint, const uint)' : 432, 2.
[02:52:629] Script message: client_screen_test : Info : Candidates are: : 432, 2.
[02:52:629] Script message: client_screen_test : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 432, 2.
[02:52:629] Script message: client_screen_test : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 432, 2.
[02:52:629] Script message: client_screen_test : Error : Illegal operation on 'const int' : 433, 2.
[02:52:629] Script message: client_screen_test : Error : No matching signatures to 'GUI_AddScreenElement(const uint, string@&, const uint, const uint)' : 437, 2.
[02:52:629] Script message: client_screen_test : Info : Candidates are: : 437, 2.
[02:52:629] Script message: client_screen_test : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 437, 2.
[02:52:629] Script message: client_screen_test : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 437, 2.
[02:52:629] Script message: client_screen_test : Error : Illegal operation on 'const int' : 438, 2.
[02:52:629] Script message: client_screen_test : Error : No matching signatures to 'GUI_AddScreenElement(const uint, string@&, const uint, const uint)' : 442, 2.
[02:52:629] Script message: client_screen_test : Info : Candidates are: : 442, 2.
[02:52:629] Script message: client_screen_test : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 442, 2.
[02:52:629] Script message: client_screen_test : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 442, 2.
[02:52:629] Script message: client_screen_test : Error : Illegal operation on 'const int' : 443, 2.
[02:52:630] Script::LoadScript - Unable to Build module<client_screen_test>, result<-1>.
[02:52:630] FOServer::ReloadClientScripts - Unable to load client script<client_screen_test>.
[02:54:916] Script message: radio : Error : Missing implementation of 'void IGUIElementCallbackInit::OnInit(int)' : 512, 7.
[02:54:916] Script message: radio : Error : Missing implementation of 'bool IGUIElementCallbackKeyPress::OnKeyPress(uint8, uint8)' : 512, 7.
[02:54:916] Script message: radio : Error : Missing implementation of 'void IGUIElementCallbackMouseClick::OnMouseClick(int, int)' : 561, 7.
[02:54:916] Script message: radio : Error : Missing implementation of 'void IGUIElementCallbackInit::OnInit(int)' : 579, 7.
[02:54:916] Script message: radio : Error : Missing implementation of 'void IGUIElementCallbackMouseClick::OnMouseClick(int, int)' : 579, 7.
[02:54:916] Script message: radio : Error : Missing implementation of 'void IGUIElementCallbackInit::OnInit(int)' : 612, 7.
[02:54:916] Script message: radio : Error : Missing implementation of 'void IGUIElementCallbackMouseClick::OnMouseClick(int, int)' : 612, 7.
[02:54:922] Script message: radio : Info : Compiling void TextboxChannel::OnKeyPress(uint8, uint8) : 529, 2.
[02:54:922] Script message: radio : Error : No matching signatures to 'IGUIElementOpt::GetText()' : 531, 23.
[02:54:922] Script message: radio : Error : Can't implicitly convert from 'const int' to 'string@&'. : 531, 15.
[02:54:923] Script message: radio : Info : Compiling void TextboxChannel::SetChannel(uint16) : 554, 2.
[02:54:923] Script message: radio : Error : No matching signatures to 'IGUIElementOpt::Text(string@&, const uint, const uint, const uint, uint)' : 557, 11.
[02:54:924] Script message: radio : Info : Compiling void ButtonSendRecv::SetState(bool) : 606, 2.
[02:54:924] Script message: radio : Error : No matching signatures to 'IGUIElementOpt::Switch(bool)' : 608, 11.
[02:54:924] Script message: radio : Info : Compiling void ButtonBroadcast::SetState(bool) : 641, 2.
[02:54:924] Script message: radio : Error : No matching signatures to 'IGUIElementOpt::Switch(bool)' : 643, 11.
[02:54:928] Script message: radio : Info : Compiling void InitRadioScreen() : 647, 1.
[02:54:928] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 656, 2.
[02:54:928] Script message: radio : Info : Candidates are: : 656, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 656, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 656, 2.
[02:54:928] Script message: radio : Error : Illegal operation on 'const int' : 657, 2.
[02:54:928] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 661, 2.
[02:54:928] Script message: radio : Info : Candidates are: : 661, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 661, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 661, 2.
[02:54:928] Script message: radio : Error : Illegal operation on 'const int' : 662, 2.
[02:54:928] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 667, 2.
[02:54:928] Script message: radio : Info : Candidates are: : 667, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 667, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 667, 2.
[02:54:928] Script message: radio : Error : Illegal operation on 'const int' : 668, 2.
[02:54:928] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 672, 2.
[02:54:928] Script message: radio : Info : Candidates are: : 672, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 672, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 672, 2.
[02:54:928] Script message: radio : Error : Illegal operation on 'const int' : 673, 2.
[02:54:928] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 677, 2.
[02:54:928] Script message: radio : Info : Candidates are: : 677, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 677, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 677, 2.
[02:54:928] Script message: radio : Error : Illegal operation on 'const int' : 678, 2.
[02:54:928] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 681, 2.
[02:54:928] Script message: radio : Info : Candidates are: : 681, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 681, 2.
[02:54:928] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 681, 2.
[02:54:928] Script message: radio : Error : Illegal operation on 'const int' : 682, 2.
[02:54:929] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 684, 2.
[02:54:929] Script message: radio : Info : Candidates are: : 684, 2.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 684, 2.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 684, 2.
[02:54:929] Script message: radio : Error : Illegal operation on 'const int' : 685, 2.
[02:54:929] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 689, 2.
[02:54:929] Script message: radio : Info : Candidates are: : 689, 2.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 689, 2.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 689, 2.
[02:54:929] Script message: radio : Error : Illegal operation on 'const int' : 690, 2.
[02:54:929] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 696, 2.
[02:54:929] Script message: radio : Info : Candidates are: : 696, 2.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 696, 2.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 696, 2.
[02:54:929] Script message: radio : Error : Illegal operation on 'const int' : 697, 2.
[02:54:929] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 707, 3.
[02:54:929] Script message: radio : Info : Candidates are: : 707, 3.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 707, 3.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 707, 3.
[02:54:929] Script message: radio : Error : Illegal operation on 'const int' : 708, 3.
[02:54:929] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 714, 3.
[02:54:929] Script message: radio : Info : Candidates are: : 714, 3.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 714, 3.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 714, 3.
[02:54:929] Script message: radio : Error : Illegal operation on 'const int' : 715, 3.
[02:54:929] Script message: radio : Error : No matching signatures to 'GUI_AddScreenElement(const uint, <null handle>, const uint, const uint)' : 720, 3.
[02:54:929] Script message: radio : Info : Candidates are: : 720, 3.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int) : 720, 3.
[02:54:929] Script message: radio : Info : IGUIElementOpt@ GUI_AddScreenElement(int, int, int, int, int) : 720, 3.
[02:54:929] Script message: radio : Error : Illegal operation on 'const int' : 721, 3.
[02:54:930] Script::LoadScript - Unable to Build module<radio>, result<-1>.
[02:54:930] FOServer::ReloadClientScripts - Unable to load client script<radio>.
[02:58:247] Script::BindImportedFunctions - Fail to bind imported functions, module<client_main>, error<-19>.
[02:58:247] Script::BindImportedFunctions - Fail to bind imported functions, module<parameters>, error<-19>.
[02:58:247] Script::BindImportedFunctions - Fail to bind imported functions, module<chosen_tabs>, error<-19>.
[02:58:247] Script message: System function : Error : Identifier 'IGUIScreenOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementButtonOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementCheckBoxOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementSliderControlOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementImageOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementTextOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementEditBoxOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementButtonOpt' is not a data type : 1, 1.
[02:58:247] Script message: System function : Error : Identifier 'IGUIElementCheckBoxOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementSliderControlOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementImageOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementTextOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementEditBoxOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementTextOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementOpt' is not a data type : 1, 28.
[02:58:248] Script message: System function : Error : Identifier 'IGUIScreenCallbackShow' is not a data type : 1, 28.
[02:58:248] Script message: System function : Error : Identifier 'IGUIScreenCallbackShow' is not a data type : 1, 26.
[02:58:248] Script message: System function : Error : Identifier 'IGUIScreenCallbackShow' is not a data type : 1, 28.
[02:58:248] Script message: System function : Error : Identifier 'IGUIScreenOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementCheckBoxOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementSliderControlOpt' is not a data type : 1, 1.
[02:58:248] Script message: System function : Error : Identifier 'IGUIElementEditBoxOpt' is not a data type : 1, 1.
[02:58:248] Script::BindImportedFunctions - Fail to bind imported functions, module<auto_aim>, error<-19>.
[02:58:699] Reload client scripts complete.

--- End code ---

wladimiiir:
I am using it on the latest revision, so this should not be an issue. Try having a look on the "stuff" I sent you via personal message. :)

Plech:
i replaced all what i should and not it says this:

--- Code: ---[01:335] Reload scripts...
[17:642] Script message: radio : Info : Compiling void EditRadioSettings(Critter&inout, Item&inout) : 3, 1.
[17:642] Script message: radio : Error : Expected expression value : 5, 2.
[17:642] Script message: radio : Info : Compiling void unsafe_ChangeChannel(Critter&inout, int, int, int, string@, int[]@) : 8, 1.
[17:642] Script message: radio : Error : Expected expression value : 10, 2.
[17:642] Script message: radio : Error : Expected expression value : 11, 2.
[17:642] Script message: radio : Error : Expected expression value : 13, 2.
[17:642] Script message: radio : Error : Expected expression value : 16, 2.
[17:642] Script message: radio : Error : Expected expression value : 17, 2.
[17:642] Script message: radio : Info : Compiling void unsafe_ChangeActivity(Critter&inout, int, int, int, string@, int[]@) : 20, 1.
[17:642] Script message: radio : Error : Expected expression value : 22, 2.
[17:642] Script message: radio : Error : Expected expression value : 23, 2.
[17:642] Script message: radio : Error : Expected expression value : 26, 2.
[17:642] Script message: radio : Error : Expected expression value : 34, 2.
[17:642] Script message: radio : Info : Compiling void unsafe_ChangeBroadcast(Critter&inout, int, int, int, string@, int[]@) : 44, 1.
[17:642] Script message: radio : Error : Expected expression value : 46, 2.
[17:642] Script message: radio : Error : Expected expression value : 47, 2.
[17:642] Script message: radio : Error : Expected expression value : 50, 2.
[17:643] Script message: radio : Error : Expected expression value : 62, 2.
[17:643] Script message: radio : Info : Compiling void SetInHand(Critter&inout, int, int, int) : 75, 1.
[17:643] Script message: radio : Error : Expected expression value : 77, 2.
[17:643] Script message: radio : Error : Expected expression value : 78, 2.
[17:643] Script message: radio : Error : Expected expression value : 81, 2.
[17:643] Script message: radio : Error : Expected expression value : 82, 2.
[17:643] Script message: radio : Error : Expected expression value : 83, 2.
[17:643] Script message: radio : Error : Expected expression value : 84, 2.
[17:643] Script message: radio : Error : Expected expression value : 85, 2.
[17:643] Script message: radio : Info : Compiling void UnsetInHand(Critter&inout, int, int, int) : 88, 1.
[17:643] Script message: radio : Error : Expected expression value : 90, 2.
[17:643] Script message: radio : Error : Expected expression value : 91, 2.
[17:643] Script message: radio : Error : Expected expression value : 94, 2.
[17:643] Script message: radio : Error : Expected expression value : 95, 2.
[17:643] Script::LoadScript - Unable to Build module<radio>, result<-1>.
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version