Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / A scripting problem - advice please

Author
Message
Scene Commander
Support Manager
16
Years of Service
User Offline
Joined: 3rd May 2008
Location:
Posted: 29th Jul 2008 11:50
Hi all,

This isn't normally something that I'd do, but I have a major script clash and I can't get them working together. I'm fairly sure that they worked prior to one of the updates but can't now be sure from memory.

The first script attached to a row of switches and prevents the player from using more than one switch at a time. (i.e. you must reset one switch to use another).



The second script simply restores health every few cycles to the player (please don't comment on the use of variables instead of timers, the timers are used else where in the game unfortunately) - The script sits in a dynamic, always active object somewhere in the background.



Now the problem I have is that both of these scripts work perfectly independently but when run together neither of them work. I can't see any clash.. Can anyone please spot anything wrong that I've missed or is there a problem with one of the updates?

Thanks again in advance.
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 29th Jul 2008 17:45
I don't know why they would.

Airslide
20
Years of Service
User Offline
Joined: 18th Oct 2004
Location: California
Posted: 29th Jul 2008 22:27
I'm not sure if this would be a problem as I haven't done much with the new variables but try it with these:




I just modified them to set the variable before modifying it. You only set it once in each script, which was likely the problem.

Scene Commander
Support Manager
16
Years of Service
User Offline
Joined: 3rd May 2008
Location:
Posted: 29th Jul 2008 23:49
Airslide,

Thank you very much, that's been driving me mad! That's solved the problem.

Thank you again.
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 30th Jul 2008 01:01
So the problem was just net setting the variable before giving it a value?

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 30th Jul 2008 01:51
No, the problem was the line that was trying to use "globalvar" as an action. Look closely at the original second code snippet. Very first line was the problem.

Good eye, Airslide.


The one and only,


Whosoever says, "Don't sweat the small stuff," is obviously not a programmer.
Airslide
20
Years of Service
User Offline
Joined: 18th Oct 2004
Location: California
Posted: 30th Jul 2008 02:25
When dealing with global variables, I assume you should use globalvar in every loop before you edit a variable. If it's using a global, non-entity-based variable to hold the index of the global variable in use, not setting them before modifying them could come up with strange results

Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 30th Jul 2008 02:45
You should always state the global or local variable before setting it or checking it.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 30th Jul 2008 07:31
Yes, wasn't that the big NOTE in my variable tutorial?


The one and only,


Whosoever says, "Don't sweat the small stuff," is obviously not a programmer.
Hybrid
17
Years of Service
User Offline
Joined: 21st Nov 2007
Location: In the p-block, group 7.
Posted: 31st Jul 2008 00:25
I don't think a lot of people paid attention to that, or t least, a lot of people forgot that. I have read it in full.

Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 12th Aug 2008 18:20
I had to read it twice but i understood it

I know not what WWIII will be fought but I do know that WWIV will be fought with sticks and stones-Albert Einstein

Login to post a reply

Server time is: 2024-11-24 12:01:28
Your offset time is: 2024-11-24 12:01:28