Jump to content

Anyone know how to script buttons for a generic menu?


KatsAwful

Recommended Posts

I'm trying to learn generic menu creation and while I'm mostly fine with structuring and basic scripting of the menu, I'm completely lost on how to control what the buttons do. I tried looking through Maskar's LINK but Maskar being Maskar there's 100 different scripts that all call on each other so its very confusing. I couldn't find anything on the CS wiki as well

Link to comment
Share on other sites

I think I figured out how Maskar made LINK. What they did was create an "OnClick" menu event handler that checks the menu ID of anything the player clicks on while inside a &GenericMenu. Then whenever the player clicks in the menu, a script is called to see if its the menu ID the player is concerned about. That then calls future scripts to do whatever

This means that the proper "target" and "id" traits must be enabled for any button tile

Link to comment
Share on other sites

I think I figured out how Maskar made LINK. What they did was create an "OnClick" menu event handler that checks the menu ID of anything the player clicks on while inside a &GenericMenu. Then whenever the player clicks in the menu, a script is called to see if its the menu ID the player is concerned about. That then calls future scripts to do whatever

 

This means that the proper "target" and "id" traits must be enabled for any button tile

That's how I would have done it as well, most likely. It's clean, easy to work with, and sounds like it follows good code design practices, though obviously I've never seen the code. But if I had implemented it I probably would have only gotten 2/3. :P

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...