![]() |
Help with && (and)
Hi guys. My learning of GScript2 is going pretty smooth, but now I'm stuck. I need to figure out how to do an AND.
In Gscript1, you could make it so if the player said something, and it equaled a certain thing, it would perform an action... Can you guys tell me how to make the equivalent of an if (playerenters&&timeout) or if (playerchats&&strequals()) type deal? Just so I can have a function onPlayerChats&&stuff or whatnot. Still trying to learn the basics of GS2. I appreciate the help. :noob: |
You have to put the if inside the function:
PHP Code:
edit: Using the newly implemented function pointers it may be possible to override the events, no idea if this is possible though, you'd be better off sticking with the above example. PHP Code:
|
Good question, I was also confused at first. The solution to your problem is using flags.
Examples: GS2: PHP Code:
PHP Code:
|
Well that sort of makes sense. But Rapidwolve, after you have the function of pie(); being called to start, how do you say what the pie action actually is? Do you put it like,
function pie(){ //stuff } Is that right? So to make a timeout, you would put function onTimeout(){ onPlayerEnters(); } So then that would equal if (playerenters&&timeout), but where exactly do you put the commands to be cycled within the timeout? Just below, anywhere? Like you guys did with the playerchats stuff? I think I'm learning something! :D I tried to incorporate what you guys are saying into a script, but the light effect is static and doesn't move. -_- What's wrong here? PHP Code:
|
Quote:
Quote:
PHP Code:
|
Quote:
|
Well I didn't really mean moving, I meant zooming. It's supposed to zoom randomly between .8 and 1.. Not too big of a change I suppose, but it makes a little flicker and looks better than just a still light. :(
Also edit, here's what I cooked up after your function PIE comment, and also I took the randomly zooming part out. This seems to be a stable lamp script apart from not zooming... :( PHP Code:
Wait, there's no need for //#CLIENTSIDE? I thought I'd forgot it but it kills the script if I put it in. |
Hold on before you do anything else, add setTimer(.5) inside the onTimeout event function.
PHP Code:
|
Ok, I fixed the spot where that timer command was set. Thanks. :D I guess I can deal with it not being a randomized zoom.
Another thing I'm planning to try to script is a music system that changes the theme depending on what level you're in. I am way too newb to script a crescendo movement for the volume, so I'll basically just have hard-edged changes... In GS1, I think it would appear something as such, but I think you need a tokenize or something to chop the filename... Asterisks don't work?... PHP Code:
|
Quote:
|
Well what you said to do ended up killing the lamp. :-\
PHP Code:
|
Quote:
PHP Code:
|
Quote:
PHP Code:
|
| All times are GMT +2. The time now is 11:29 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.