[22 Mar 2007] HW2.5 checkEvent / MakeButton

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

[22 Mar 2007] HW2.5 checkEvent / MakeButton

Post by GMKai »

Note: This is an archived post that was originally sent to the Hollywood mailing list on 22 Mar 2007 11:28:54 +0100

Hello everybody,

as a new owner of HW2.5 I tend to adopt my current project to it. What annoys me is that the function CheckEvent() is no longer supported, but I will find a way around it.

A more serious problem comes with the reaction to events triggered with buttons. When starting my script my menu is displayed with different buttons to trigger. This leads to a new screen which isn't displayed under 2.5 HW moans the following: "Falsche Benutzung/Argumente für diesen Befehl! überprüfen Sie die Dokumentation! Datei: config.hws ( aktuelle Zeile: 35 - In Funktion: WaitEvent)

Here the codesnippet:

Code: Select all

Function p_Settings()
    EnableLayers()
    DisplayBGPic(10)
    LoadBrush(12,"gfx/but_diff.png")
    settingsmenu = 1
    menuisactive = 0
    DisplayBrush(11,#Left,#Top)
    evtSmatch =  { OnKeyDown = p_SettingsMenuFunc, OnMouseUp = p_SettingsMenuFunc }
    /*back to main menu*/
    MakeButton(11,#SimpleButton, 0, 0,100,100,evtSmatch)
    SetFillStyle(#FillNone)
    /*change difficulty*/
    MakeButton(12,#SimpleButton, 50,100,50,50,evtSmatch)
    p_ChangeDiffBrush()
    p_InitFonts()
    /*inputkeys*/
    MakeButton(13,#SimpleButton, 50,175,50,50,evtSmatch)
    DisplayBrush(13,50,175)
    /*playername*/
    MakeButton(14,#SimpleButton,250,175,50,50,evtSmatch)
    DisplayBrush(14,250,175)
    /*save*/
    MakeButton(15,#SimpleButton, 50,250,50,50,evtSmatch)
    DisplayBrush(15,50,250)
    /*load*/
    MakeButton(16,#SimpleButton,125,250,50,50,evtSmatch)
    DisplayBrush(16,125,250)
    /*default*/
    MakeButton(17,#SimpleButton,200,250,50,50,evtSmatch)
    DisplayBrush(17,200,250)
    /*Display Controls*/
    MakeButton(18,#SimpleButton,150,175,50,50,evtSmatch)
    DisplayBrush(18,150,175)
    Repeat
       WaitEvent ; IT JUMPS OUT AT THIS POINT
    Forever
EndFunction 
The same construct works with the main menu, but for what reason does it fail in the submenus? The "ActionListener" from the main menu isn't deactivated does that cause any conflict?

Regards GMKai
User avatar
airsoftsoftwair
Posts: 5830
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[22 Mar 2007] Re: HW2.5 checkEvent / MakeButton

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Thu, 22 Mar 2007 11:42:45 +0100
Hello everybody,

as a new owner of HW2.5 I tend to adopt my current project to it. What annoys me is that the function CheckEvent() is no longer supported, but I will find a way around it.

A more serious problem comes with the reaction to events triggered with buttons. When starting my script my menu is displayed with different buttons to trigger. This leads to a new screen which isn't displayed under 2.5 HW moans the following: "Falsche Benutzung/Argumente für diesen Befehl! überprüfen Sie die Dokumentation! Datei: config.hws ( aktuelle Zeile: 35 - In Funktion: WaitEvent)

[...] The same construct works with the main menu, but for what reason does it fail in the submenus? The "ActionListener" from the main menu isn't deactivated does that cause any conflict?
You're calling WaitEvent() again in a callback function. Don't do that!

Use WaitEvent() only ONCE in your script! Your main loop should always look like this:

Code: Select all

Repeat
  WaitEvent
Forever   ; or Until quit = False or something similar
It is really enough to use WaitEvent() once in your scripts! It's just a matter of coding. Look at the example scripts... they all use WaitEvent() only once! It can all be done with just a single call to WaitEvent().
GMKai
Posts: 158
Joined: Mon Feb 15, 2010 10:58 am

[22 Mar 2007] Re: HW2.5 checkEvent / MakeButton

Post by GMKai »

Note: This is an archived post that was originally sent to the Hollywood mailing list on 22 Mar 2007 15:17:20 +0100

Hallo Andreas,

changed, checkEvent is replaced aswell... Thanks for Hollywood and your great support.
Locked