3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: 1 ... 3 4 [5] 6

Author Topic: Script related questions  (Read 8110 times)

« Reply #60 on: October 11, 2013, 09:07:46 PM »
your brackets are setup wrong

the void main() should inclose all your runtime code like this

Code: [Select]
void Main() {

   if  (iObjectStart(OBJ_0)) {
      if (timer = -1) timer = 0;
      if (timer > -1) timer += 0.016667;
      if (timer > .5) {
         ObjectHide(OBJ_66);
         timer = -1;
      }
   }
}

something like that.. this isnt tested code.. just showing you how to enclose script in the {  } brackets..

Using the "check script" button in the script editor may also give you some clues.. use it.
« Reply #61 on: October 12, 2013, 03:10:14 AM »
Himel, does the script object return a syntax error?

Because this is not correct:
"if  (iObjectStart(OBJ_0))"
iObjectStart() is void, it doesn't return anything.
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #62 on: October 16, 2013, 12:09:44 PM »
The syntax is bit correct m. Now stuck in playing game. I ll work later.
« Reply #63 on: October 25, 2013, 04:35:52 AM »
If the conditions are simultaneous then statement can be used. What should I do when a happens and then b happens after these two sequential conditions c wil happen. Not c will happen if b happens only or two conditions occur at the same time. For example if the car jumps and same time dashes then the car will not vanish (can be both with or without timer). But it jumps and it then dashes it will vanish.
Isn't there any word reserved for this in angelscript or I have to use timer after first condition also. Please please help.
« Reply #64 on: October 26, 2013, 03:57:53 AM »
Not entirely sure what you mean, but a timer is indeed the way to go.
Not much else to say about it.
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #65 on: October 28, 2013, 08:12:31 AM »
Sorry for disturbing again. But I think I have to do this a lot of times.
I wrote. ..
float timer = -1
void Main()
{
if (iKeyDown(iKeyCode("DIK_RETURN")))
{
if (timer = -1)
timer =  0;

if (timer > -1)
timer += .1;

if (timer > .5)
{
iObjectHide(OBJ_0);
timer = -1;
}
}
}
I pressed check script it said unexpected token if l8 pos1
and for line 12 and unexpected token } l17 pos1.
« Reply #66 on: October 29, 2013, 10:31:59 AM »
First of all, you need to define the amount of 'levels' of functions and if-statements. This doesn't matter for syntax, but it required to prevent your code from getting understandable.
So instead of...
void Main()
{
if (timer > 0.5)
{
//Do stuff.
}
}

...Use tab spaces:

void Main()
{
   if (timer > 0.5)
   {
      //Do stuff.
   }
}

With this thing called 'spacing' one can easily see what part of code falls beneath which if-statement.


Now about your code, a '=' symbol is an expression operator (if I'm not mistaken) and puts the something on the right into the something on the left.
What you're looking for is a so called boolean operator. In that case of 'equals', that would be '=='.

In short, for an if-statement, use '==' instead of '='.

This should solve all syntax errors.
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #67 on: October 29, 2013, 12:02:11 PM »
I have put == several ways but still same message. Can u give me the code.
« Reply #68 on: October 30, 2013, 10:14:19 AM »
You forgot a semicolon after the very first line. Sorry, hadn't seen it yesterday.

The working code:
Code: [Select]
float timer = -1;
void Main()
{
   if (iKeyDown(iKeyCode("DIK_RETURN")))
   {
      if (timer == -1) timer = 0;
      if (timer > -1) timer += 0.1;
      if (timer > 0.5)
      {
         iObjectHide(OBJ_0);
         timer = -1;
      }
   }
}
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #69 on: October 30, 2013, 11:31:08 AM »
Wow, but I am replying without examining too much. Now I have understood the full code I can use this procedure on further gaming uses. The four wheel did not vanish and I have to hold enter, not just taping it once if timer extends. I changed the group object to. The wheels skunmesh car.
« Reply #70 on: November 03, 2013, 06:57:19 AM »
How to vanish the wheels?
« Reply #71 on: November 04, 2013, 12:13:03 PM »
 ???

For Pete sake, English! The language of this forum is English, not gibberish.

I understand your English is not flawless, but neither is mine.

Just make simple sentences with some basic punctuation. Help us help you.
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
« Reply #72 on: November 04, 2013, 02:06:01 PM »
From what I am "reading" it seems like you have a car object and skinmeshes for the car AND all 4 wheels.  If you hide the skinmesh for the car you have to link the skinmeshes for the wheels to the script and hide them as well, so the part of your script that says

iObjectHide(OBJ_0);

should also include the 4 wheel object skinmeshes, if their object IDs were 22, 44, 66, and 88 the script would be:

if (timer > 0.5)
{
   iObjectHide(OBJ_0);
   iObjectHide(OBJ_22);
   iObjectHide(OBJ_44);
   iObjectHide(OBJ_66);
   iObjectHide(OBJ_88);
}

Just replace the object IDs with whatever your's are in the script object list.  You could also use an event timer to hide everything and just start the event timer object in there and set the timer to very low like 0.01, but that might just confuse you more.

Disclaimer:  I am in no way, shape, or form a code expert, but I get this much so I am qualified to give advice on it.
« Reply #73 on: November 12, 2013, 11:45:47 AM »
The script nor the event on input vanishes wheels and the car goes upside down if I drive the car after pressing enter.

« Reply #74 on: November 13, 2013, 02:52:03 PM »
@himel
simple question: do you have skinmesh wheels attached to the cars wheels...


--Mike



Pages: 1 ... 3 4 [5] 6