Jump to content

All in one or all a waste?


phoneyLogic

Recommended Posts

Hey folks,

I want to make a script which strarts a menu

1. by the FOSE command "IsKeyPressed" or ( to make this mod non-FOSE compatible )

2. by a variable

 

It would look like this

Begin GameMode
If ( IsKeyPressed xy == 1 ) || ( variable == 1 )
   do stuff and
   ShowMessage WhichIsVerySignificant
endif
End

 

So, can I use the IsKeyPressed function in the same script without having to worry about side effects if someone does not use FOSE? The GECK will return errors if you don't have FOSE support, but will there occur problems within the game?

 

Maybe it's a stupid question, but I really want to know about your opinions.

 

Thanks in advance,

tT

Link to comment
Share on other sites

First off, that's not how IsKeyPressed works. In order to test if a key is pressed, you need to pass that key's scancode as a parameter to IsKeyPressed, which will then return 1 if the key is pressed, and 0 if it is not. If it worked the way you've tried to use it, it would break as soon as more than one key was held down during the same frame.

 

When it comes to using both FOSE and non-FOSE methods, you need some way to prevent any FOSE functions from being executed. If a script tries to execute a FOSE function while FOSE is not loaded, that script will halt, and will not run again until the game is restarted.

 

The best method of doing this that I know of is shown in JustinOther's The Chicken and The Egg tool. If you use this method, then you'll want to use something like this to separate the two methods:

int foo

Begin GameMode
if FOSE
	if IsKeyPressed xy
		set foo to 1
	endif
endif

if foo
	;do stuff
endif
End

Cipscis

Link to comment
Share on other sites

First off, that's not how IsKeyPressed works.
Hehe yes, of cause, sorry, I just forgot to mention the key which has been pressed.

 

When it comes to using both FOSE and non-FOSE methods, you need some way to prevent any FOSE functions from being executed. If a script tries to execute a FOSE function while FOSE is not loaded, that script will halt, and will not run again until the game is restarted.
Thank you, this is exactly what I wanted to know.

 

The best method of doing this that I know of is shown in JustinOther's The Chicken and The Egg tool. If you use this method, then you'll want to use something like this to separate the two methods: (...)
I'll give a try :thumbsup:
Link to comment
Share on other sites

  • Recently Browsing   0 members

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