Author Topic: Problems with scripting  (Read 2592 times)

LucasK

  • Crewmate
  • **
  • Posts: 34
    • View Profile
Problems with scripting
« on: April 15, 2012, 03:19:49 pm »
I'm trying to use scripts to enhance my new level, just in the beginning i put a shaking effect, it worked well, but then i put something to viridian to say, well, i tested and he says it, but the music and the sounds don't play, someone can help me? (This only happens after i put something to Viridian to say)

EDIT: By the way, somebody can tell me how i make a script play only once?
« Last Edit: April 15, 2012, 03:25:32 pm by LucasK »

FIQ

  • Captain
  • *****
  • Posts: 811
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Problems with scripting
« Reply #1 on: April 15, 2012, 05:38:28 pm »
I guess you typed "m" in the script editor somewhere, it mutes the game. Unintuitive yes, and it's fixed in a patch (which is not released yet, however). Press m again to turn off the mute.

You can do this to prevent a script from happening more than once:

Script: script1
ifflag(1,stop)
do things here, bla bla ...
flag(1,on)

Script: stop
stop()

Then, if it runs one time, it will turn on a flag (flag 1). This is checked for before anything else, then the stop script is running (which contain nothing else than stop()). It will not stop the first time as flag 1 isn't on then.

LucasK

  • Crewmate
  • **
  • Posts: 34
    • View Profile
Re: Problems with scripting
« Reply #2 on: April 15, 2012, 06:53:56 pm »
"Script: script1
ifflag(1,stop)
do things here, bla bla ...
flag(1,on)

Script: stop
stop()"

I tried this, but the dialogue still plays more than one time.  :victoria:

FIQ

  • Captain
  • *****
  • Posts: 811
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Problems with scripting
« Reply #3 on: April 15, 2012, 07:51:45 pm »
"Script: script1
ifflag(1,stop)
do things here, bla bla ...
flag(1,on)

Script: stop
stop()"

I tried this, but the dialogue still plays more than one time.  :victoria:
Should work!
Can you post a quick small test level of you doing it so I can see what's wrong?

LucasK

  • Crewmate
  • **
  • Posts: 34
    • View Profile
Re: Problems with scripting
« Reply #4 on: April 15, 2012, 08:52:31 pm »
Where i must put the "stop" script? I think that's the error.

FIQ

  • Captain
  • *****
  • Posts: 811
  • https://github.com/FredrIQ/
    • View Profile
    • FIQ
Re: Problems with scripting
« Reply #5 on: April 15, 2012, 11:18:05 pm »
Create a scriptbox, and from there name the script "stop". Then, remove the scriptbox. The stop script will persist.