![]() |
Scripting questions
I've looked around, and I don't see anyone else asking these questions so I'll ask them here. Please try to answer my questions in the simplest form that you can. There will be multiple questions. And a attempt to make things easier, I'll post 1/2 of the script & function here, and ask questions below it.
In trying to make my questions clear and less missunderstood, I bolded the questions... So I hope there won't be no missunderstandings. PHP Code:
Questions: First off can someone explain "for"? I thought I had a good grip on what it means but I'm not sure anymore. Note: this.bullets is how many shots fired/taken away from the gun. Just to save trouble for posting later.. I'll ask about these too. Whats the diffrence between player.x and vecx? And most likely a dumb question but, is random a event? Not sure of its purpose but believe it to regulate the spread. Last two questions... And in temp.x , does(player.dir[1]) mean the first direction? In (temp.angle = (pi / 2) * (player.dir + 1); Also does player.dir + 1 mean the first direction? If not what do they mean? thanks to whoever reads this and tries to help me for your time. |
Quote:
PHP Code:
PHP Code:
Quote:
Quote:
|
Quote:
These are the directions in numbers: 0: Up 1: Left 2: Down 3: Right Quote:
|
This might help with the for loop.
Quote:
|
Alright thanks guys I think I understand it all now, gonna keep playing with scripts to get the best handle I can get on them. But thanks again. :)
Edit: messed up on something, it wasn't PHP Code:
it was: PHP Code:
been doing quite a bit of editing to this script, trying to understand its functions and what not etc. And this wasn't copied/pasted. so yeah sorry about that. If someone could, could they re-explain those lines? |
so
PHP Code:
PHP Code:
|
that kind of depends on the array
|
Or if you even want to loop through an array. It always depends on what you want to do.
|
Quote:
Arrays store multiple variables. PHP Code:
The second line outputs "Hello World!" on RC. To get a specific variable from an array, you need [#], where the number inside braces ([]) relates to the position in the array starting at the lowest integer 0, so "Hello" is 0, "World" is 1, and "!" is 2. Now for multi-dimensional arrays. PHP Code:
The second line outputs "Hello World!" on RC. It gets the first array's variables with array[0][#]. The third line outputs "Nice day we're having!" on RC. It gets the second array's variables with array[1][#]. Also, please stop with all the enters. Quote:
PHP Code:
For-Each Loops PHP Code:
For-each loops are simplified from this. PHP Code:
Too much explaining... |
Quote:
Nothing wrong with that, helps people that don't know how to use 'for' and the uses of it understand it better. Also saves possible future questions. Thanks guys, all this helped a lot. Now I got one last thing fustrating me, Now for me this is pretty pathetic on my part if I really did this wrong. Such a simple script. But not working for me. I was trying to test my knowledge on arrays by making a list, and then having a specific variable be output in F2 in-game. That failed, so I went even simpler. Just to see if I was doing something wrong This is what I did.... PHP Code:
I Also tried this server-side, and it worked, once? Out of the 5x i tried calling on it. What did I mess up on? |
Quote:
|
Yeah but it's alright now I think, had to delete most of my weapons for whatever script I created to work but, it seems to be working for now.
|
Quote:
|
| All times are GMT +2. The time now is 01:58 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.