![]() |
Help
hey i dont understand Variables (cant spell it) and what the do. i went on your site projectshifter and i got to the variables bit and i just didnt understand what they do?can some one help me learn them?
|
Ah, they are VERY useful. They keep track of numbers. For example:
NPC Code: that makes this.hit go up ONE time everytime it was hit. And it will display it via #c as how many hits have happened. This.vars are ONLY for NUMBERS, no data can be stored in them. But I've done things like this: NPC Code: Something like that, i'm not exactly sure b/c I'm at school :P and i don't have much time. BUT I had a central NPC set npcs[1].save[1 and 2] to it's x and y. So this.dist was the distance it was from the central point. It was useful because I was making a clock that rotated around the middle, so I didn't have to code everything to be so far from the central point, I could move it out to ANY distance I wanted and it would still make a circle around that middle point. the radius changed, but the middle point didn't :D Try some stuff... I'll get you some examples if I get home in time. ---Shifter |
i get..
hey i get the top one but not the bottom one :/ i think it has something to do with the save and stuff in it
the top 1 is easy to understand and i think i can get the hang of it to Quote:
--snakeandy |
do not format like shifter because his formatting is teh suck :| (no offence)
|
w00t WooT! USe my scripting style, it's going Revolutionary! people use it :P Yes, I like my scripting, just b/c you don't doesn't mean you are allowed to become jealous ;) But obviously you're not sure how to use functions :P If you put: something(); it means that it will jump to the part of the scripted marked:
function something() and perform all actions under it. I always use return; at the end if it isn't looping for teh hell of it. What you did would have it set it to what you said, then it would set to mine, so it then becomes inefficient b/c you are setting it twice and one will be erased too fast to read it? ---Shifter |
i think functions should have custom variables that can only be used inside the functions, e.g.
PHP Code:
|
Quote:
|
*realises this*
but it SHOULD be added. |
Quote:
|
Exactly!
|
WTF is the point?? If you can ONLY set them in functions??? Just have the variables ONLY be changed by them then =/
---Shifter |
You'd need an actual return command then, like
return account,message; |
Um, this.vars work regardless of where. then ONLY have functions edit them x.X!
---Shifter |
Shifter, what's your point? Of course there is a way to work around not being able to pass strings/variables to functions, but the point is that being able to do so would greatly increase the functionality of functions...
|
Function arguments, it was suggested by me and a few other people long long time ago, yet never added, Some problem that graal isn't too object-orientated. *shrugs*
|
All times are GMT +2. The time now is 12:26 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.