Author Topic: New Fix Boy with multipler  (Read 2028 times)

New Fix Boy with multipler
« on: September 08, 2014, 09:32:42 am »
Hello!
I'm working now on the new Fix Boy screen with multipler. Now I have problems with "old buttons" and Fix Boy's main text screen.
What scripts should be in:
- FixBoy's main text screen,
- FixBoy's old buttons, like screen up, screen down, fix and done,
???

Is there somewhere place with examples of client screens?

Please help! :)

remake

Re: New Fix Boy with multipler
« Reply #1 on: September 08, 2014, 09:53:04 am »
Look around fixboy.fos and other name-related scripts. Try to look into TLA or FO2 graphics at  pure evil zip.

Re: New Fix Boy with multipler
« Reply #2 on: September 08, 2014, 10:35:32 am »
But I need also init this new screen from script gui_screens.fos standing on server side.

For expample, first I need to add another line in void InitializeScreens () function:
Code: [Select]
FixBoy::Init( CLIENT_SCREEN_PIP_BOY );
And after that:
Code: [Select]
namespace FixBoy
        {
          <old fixboy's classes>
          <my new fixboy's classes calling for new scripts>
        }

Of course I know how to call my new scripts, but I don't know how to call older.

Re: New Fix Boy with multipler
« Reply #3 on: September 08, 2014, 02:19:21 pm »
Read SDK docs from svn or ask around #fodev on IRC. (Some kind old docs can be found on koniko.fode.EU/fodocs ).

If u success don't forget to share work :>.

Re: New Fix Boy with multipler
« Reply #4 on: September 08, 2014, 07:53:11 pm »
There are the same things as in actually sdk docs. :(

Offline Wipe

  • Rotator
  • Random is god
Re: New Fix Boy with multipler
« Reply #5 on: September 11, 2014, 07:08:14 am »
I see you trying to use new GUI to remake fixboy screen... it won't be easy or (i think) even possible currently. Well, not without writing whole client<->server communication first, which lays deep into source right now. Not even CustomCall() will help you, as it have nothing related to fixboy at this point.

If you don't want to wait for screen to be put into SDK (where i really hope communication will be scripted too) i'd recommend to use old/hardcoded screen, and add your buttons/counters into it.
I'd roll with something like that:
  • edit default.ini and make a place for your controls
  • create .fogui screen with different id than CLIENT_SCREEN_FIXBOY; use the background graphic from default.ini, just to make things easier
  • add a GUIPanel in your empty space and add controls you need to it
  • when user change amount of items to create, send a fast RunServerScript() which will save the number in critter-related place (bindfield, param, lvar)
  • find a way to copy GUIPanel and all its childs from your screen (which will never be seen by user) into old/hardcoded screen and change GUIPanel parent to it
  • modify crafting function to respect that number during items spawning
  • drop a tear of joy

Once SDK will get a Fixboy.fogui, and it would not contain multiplier, you already have a code for it so it will be matter of c/p around. If it would have, well... at least you learned something new what may or may not help you in future, or others which are doing transition from old/own gui to one provided in SDK :)



After posting this i realized i needed something in that manner for myself. Instead of fixboy, i wanted to add something to character screen; just like fixboy it's still hardcoded, so it can be good example. Here it is, injecting VTDB button into character screen after updating 2238 to new gui, with .fogui file registered as CLIENT_SCREEN_VTDB_CHARACTER.

Cloning GUIPanel, unlike what i though before starting, was easiest part, so let's start with this. At first i tried to keep it inside .fogui but it didn't work well, so i've added this after GUI_EngineCallback_Start()
Code: [Select]
GUIPanel@ panel = GUI_GetScreen( CLIENT_SCREEN_VTDB_CHARACTER ).FindPanel( "ButtonPanel" );
GUIScreen@ character = GUI_GetScreen( CLIENT_SCREEN_CHARACTER );
if( valid(panel) && valid(character) )
panel._Clone( character );

Easy, right?
After launching the game button and text was in right place and displayed correctly. Until you tried to move character screen - none of my my controls moved with screen... Oh noes!
To fix this, i've set panel position to 0,0 (so child controls won't need extra fixes) and added fetching character screen position on every drawing loop, then setting panel position to it.
Code: (ButtonPanel::OnDraw) [Select]
int x = 0, y = 0;
GetHardcodedScreenPos( CLIENT_SCREEN_CHARACTER, x, y );
SetPosition( x, y );

Another problem showed up - if you hold pressed button and move mouse, it changed button position... Disaster!
This one took a little time, as i don't know new GUI too well yet, and i didn't want to edit gui_h.fos either. It ended with overriding one of GUI functions responsible for moving object around...
Code: (ButtonPanel::ClassFields) [Select]
bool AllowMove = true;
Code: (Button::ClassFields) [Select]
void _Move( int deltaX, int deltaY, bool callCallback, bool moveBasePos ) override
{
    if( cast<ButtonPanel>(Parent).AllowMove )
        GUIObject::_Move( deltaX, deltaY, callCallback, moveBasePos );
}

...and updating panel-positioning function
Code: (ButtonPanel::OnDraw) [Select]
int x = 0, y = 0;
GetHardcodedScreenPos( CLIENT_SCREEN_CHARACTER, x, y );
AllowMove = true;
SetPosition( x, y );
AllowMove = false;

And bam, button stay in its place and doesn't derp around. Great success!
Hope it will help, if not you then maybe someone else (hi Lidae!) thinking about switching to SDK GUI.
« Last Edit: September 11, 2014, 05:57:26 pm by Wipe »
Games are meant to be created, not played...