Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   putnpc3 (Nothing New) (https://forums.graalonline.com/forums/showthread.php?t=81271)

TheStan 08-16-2008 06:02 PM

putnpc3 (Nothing New)
 
Just whipped up a quick little putnpc3() function to make it easier on folks who'd rather not make an npc in a level in the level editor etc. then upload etc.

PHP Code:

/**** Notes ****\
PARAMS:
  levelname - The level you wish for the npc to be placed at.
  x - The x coordinate the npc will be placed at.
  y - The y coordinate the npc will be placed at.
  classes - Supports both arrays and single strings. List of classes joined to the npc.
  vars - Supports both arrays and single strings. Variables you wish set to the npc.
  vals - Supports both arrays and single string. Values for the variables.
\***************/
public function putnpc3(levelnamexyclassesvarsvals) {
  
with (findlevel(levelname)) {
    
with (putnpc2(xy"")) {
      if (
vars.type() == vals.type()) {
        if (
vars.type() == 3) {
          if (
vars.size() == vals.size()) {
            for (
0vars.size(); v++) {
              
this.(@ vars[v]) = vals[v];
            }
          }
        }
        else {
          if (
vars.type() == 1) {
            
this.(@ vars) = this.(@ vals);
          }
        }
      }
      
this.joinedclasses classes;
    }
  }



DrakilorP2P 08-16-2008 06:10 PM

Requesting {{variable, value}, {variable, value}} pairs.

xXziroXx 08-16-2008 06:12 PM

I don't get what it's supposed to do, I've always had a problem reading your codes. :frown:

Inverness 08-16-2008 06:27 PM

Stan probably copied the separate vars and vals parameters from me. Though I have decided not to do that any longer.
Quote:

Originally Posted by xXziroXx (Post 1414916)
I don't get what it's supposed to do, I've always had a problem reading your codes. :frown:

If the parameter names and function name don't make it obvious enough the notes should.

xXziroXx 08-16-2008 06:33 PM

Quote:

Originally Posted by Inverness (Post 1414918)
If the parameter names and function name don't make it obvious enough the notes should.

Well, it's obviously a wrapper, however I don't get the reason for it. People should stop reinventing the wheel, when it can't get any better then it already is.

DrakilorP2P 08-16-2008 06:34 PM

Quote:

Originally Posted by Inverness (Post 1414918)
Stan probably copied the separate vars and vals parameters from me.

You mean "stole"?

Inverness 08-16-2008 06:36 PM

Quote:

Originally Posted by DrakilorP2P (Post 1414922)
You mean "stole"?

No, I don't. Because Stan learned a lot from me and I have no problem with him looking at my stuff.

TheStan 08-16-2008 06:45 PM

Quote:

Originally Posted by DrakilorP2P (Post 1414915)
Requesting {{variable, value}, {variable, value}} pairs.

Would probably be more efficient...

Quote:

Originally Posted by DrakilorP2P (Post 1414922)
You mean "stole"?

Nah, I picked up quite a few habits from Inver.


All times are GMT +2. The time now is 08:06 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.