I have lots of vars for the players characthers and if I understood all right, as they are declared under /mob, all mobs, including NPC's will also have them. Is there any way to set up a vars for players only? Maybe an "If (isplayer)" under /mob/var [I dunno how to code this]?
I think that cleaning up the amount of var for only those who will really need them will reduce the lag and processing, making the game faster...Ain't I right?
Can someone help me please?
Regards
Leandro
ID:177588
Aug 23 2002, 11:23 am
|
|
Aug 23 2002, 11:29 am
|
|
If you want only players to have the vars, they have to be defined under mob/Player. Then, have all players mobs be mob/Player/(Whatever) or just mob/Player
|
In response to Garthor
|
|
Right. And to make sure all players are of type /mob/Player, set world.mob equal to /mob/Player.
|
In response to Air Mapster
|
|
I placed the vars under mob/Player/var
Then, no proc found them anymore I placed the procs under mob/Player/proc but they still can't find the vars Why? Am I missing something? Regards Leandro |
In response to Leahn
|
|
I will try to be more specific
(Why programming in BYOND is so difficult?) I am using some vars under /mob They are vars for all (mob and players) and I am using some vars under /mob/player They are vars used for level ups and save checks There are some procs and verbs that are only used under some circunstances than I placed then nor under /mob or /mob/player but under nothing like verb kick and so on Any proc or verb under /mob cannot find the vars under /mob/player and the procs and verbs under nothing cannot find any var How can I address the vars? |
In response to Leahn
|
|
Are you referring to the variable in the form 'src.varname' (or possibly 'varname' if it is not defined in a more local structure)?
|
In response to Leahn
|
|
Leahn wrote:
I will try to be more specific BYOND is actually a very easy language, from what I hear. I am using some vars under /mob Procs that are under "nothing" are called global procs. How can I address the vars? For the first problem, I'm assuming you have a setup like this: mob/player If your setup looks like that, then you're going to need to do a bit of changing. For example, why not redefine LevelCheck() for players? Example: mob/proc/LevelCheck() //this proc normally does nothing The second problem is about global procs. You're going to need to either use args or search for the mobs you want, since there is no src for global procs. You can't have global verbs, either. So let's say you have a proc like this: proc/MyProc() It is a very bad idea to use usr, because you don't know who's calling the proc. Instead, you could add an argument to MyProc() and stick the mob in there. For example: proc/MyProc(mob/M) You can use any number of args you want. For example, let's say you wanted an Attack command. proc/Attack(mob/attacker,mob/defender) Even better, you can used named arguments so you don't have to put them in order. mob/verb/attack(mob/M in oview()) Named arguments are nice because they let you know which arg is which. Remember that named arguments don't work for most predefined procs, but they will always work for the procs you define. |
In response to WizDragon
|
|
WizDragon wrote:
BYOND is actually a very easy language, from what I hear. BYOND is very confusing, guy. Very very confusing...I mastered Lingo in less time... For the first problem, I'm assuming you have a setup like this: If I setup like this, it won't find the vars needed and this is my problem. As I said, procs and verbs which are not under the same "tree" level do not find the other vars. Will it be solved by resolving who is calling like verb/attack(mob/attacker,mob/defender) ? You can't have global verbs, either. Why not? I have some verbs added or subtracted under circunstances like classes and so on. Where should I place them that they would not appear under any stat panel until needed? Named arguments are nice I agree...Maybe I will rewite the code to use them...if I handle to solve the problem with the vars... Regards and many thanks Leandro |