Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need script help asap! extremely difficult script!
TheGreatCthulhu Offline
Member

Posts: 213
Threads: 10
Joined: Oct 2010
Reputation: 32
#22
RE: Need script help asap! extremely difficult script!

(12-20-2012, 08:29 PM)dnalange Wrote: PS... is it possible to have 2 controlpanels in map?
Trying but not working here... hmmmsssss
If not possible i will do somethng else { alrdy build an alternative tho }
It is possible, for both my and Apjjm's code, but you have to be careful when making the modifications.

Actually, if the pass-code functionality was implemented using a class, (what most people here refer to as "object stuff"), it would be fairly easy to have as many control panels as you'd like.
However, although the script engine supports this to some extent, classes and object-oriented programing are somewhat more advanced concepts, so without going down that road, you would have to duplicate certain functions in the script file (although this can maybe be avoided to a degree by using some if-statements), and then make some changes to the duplicated code (to match the new set of script areas / entities).

This approach is tedious and error prone (and duplicating code is not a good practice), but it can be done if you're careful. You'd have to know exactly what functions need to be copied, and where exactly the tweaks need to be made - so you must, at least on a basic level, understand how the script does what it does.

In my script, for example, you would make an additional version of OnButtonPress(), OnAccept(), OnCancel() and ResetUserCodeVars() functions (of course, they cannot have the exact same names as the originals), you'd need a second set of the userEntry, numPresses and secret pass code variables. You would also need to make modifications to OnEnter() function (to hook up the second control panel), as well as to the GetDigitFromButton() function (to make it work with the second control panel).
This can potentially result in a huge mess, so if you decide to try it, take it slow, and one step at a time.
(This post was last modified: 12-20-2012, 09:31 PM by TheGreatCthulhu.)
12-20-2012, 09:28 PM
Find


Messages In This Thread
RE: Need script help asap! extremely difficult script! - by TheGreatCthulhu - 12-20-2012, 09:28 PM



Users browsing this thread: 2 Guest(s)