Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: Ege115 on May 17, 2014, 08:18:22 pm
Title: Button script problem
Post by: Ege115 on May 17, 2014, 08:18:22 pm
I have trouble with this script. I am trying to make so you will have to press 4 buttons and then thread a function. But ingame it threads the function if I only press 2 of the buttons. Why is this happening? In my script it says 4 buttons but ingame it threads after 2 hits. Thanks in advance.
Title: Re: Button script problem
Post by: ConvictioNDR on May 17, 2014, 08:27:53 pm
I'm new to scripting so maybe not the best answer but worth a shot until someone better at scripting can help if it doesn't work. Try something more like this?
Title: Re: Button script problem
Post by: MakeCents on May 17, 2014, 08:29:17 pm
I have trouble with this script. I am trying to make so you will have to press 4 buttons and then thread a function. But ingame it threads the function if I only press 2 of the buttons. Why is this happening? In my script it says 4 buttons but ingame it threads after 2 hits. Thanks in advance.
Looks fine to me... Shot in the dark... You don't call main more than once do you?
Title: Re: Button script problem
Post by: Ege115 on May 17, 2014, 08:45:39 pm
I'm new to scripting so maybe not the best answer but worth a shot until someone better at scripting can help if it doesn't work. Try something more like this?
That wouldn't matter, I call the function as "self". And in that case self is always the entity I called it from in "main". But thanks anyway :D.
Looks fine to me... Shot in the dark... You don't call main more than once do you?
I call main only once. :/
Title: Re: Button script problem
Post by: PROxFTW on May 17, 2014, 08:57:19 pm
Quick made script. See how this works then maybe I can modify based on the results.
Title: Re: Button script problem
Post by: ConvictioNDR on May 17, 2014, 08:59:56 pm
Couldn't hurt to try though yeah? I use a similar script in my map. I noticed it was adding a number already cuz I accidentally had two trigs with the same targetname. So I'd say check the target names make sure none are accidentally the same or with typo.
Title: Re: Button script problem
Post by: MakeCents on May 17, 2014, 09:01:13 pm
Sorry, just thought it might be 4 cause it ups the level variable twice, maybe. Did you check the level.switchs_hit with an iprintln after the waittill trigger? If counting by twos, then something is doubling. You could just make it 8 if you can't figure it out. If it counts by 1s and is working on 2, then sorry for wasting your time, cause I'm out of ideas.
Title: Re: Button script problem
Post by: Ege115 on May 17, 2014, 09:30:59 pm
Couldn't hurt to try though yeah? I use a similar script in my map. I noticed it was adding a number already cuz I accidentally had two trigs with the same targetname. So I'd say check the target names make sure none are accidentally the same or with typo.
You solution would work as well, this script is just how I thought. :)
Sorry, just thought it might be 4 cause it ups the level variable twice, maybe. Did you check the level.switchs_hit with an iprintln after the waittill trigger? If counting by twos, then something is doubling. You could just make it 8 if you can't figure it out. If it counts by 1s and is working on 2, then sorry for wasting your time, cause I'm out of ideas.
You didn't waste my time at all. xD no need to say sorry.
Also, I solved it, it was something I did wrong in the script simply. Thanks for he help anyways, but sorry for wasting YOUR time. xD
Edit: but I give the best answer to prox, because your way is to use arrays which is smarter than the script I had. :D
Title: Re: Button script problem
Post by: ConvictioNDR on May 17, 2014, 09:35:38 pm
Mind saying what the error was? Just in case someone else gets the same issue? They might have made the same mistake.
Title: Re: Button script problem
Post by: Ege115 on May 17, 2014, 09:47:10 pm
Oh, yea sure thing.
The script was called twice in mapname.gsc which dublicated the amount of times you pressed the buttons.
Title: Re: Button script problem
Post by: MakeCents on May 18, 2014, 02:07:50 am