Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-19-2008, 09:38 AM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
odd problem i think

when i update my "Control-NPC" it says this

Quote:
The script of NPC Control-NPC has been updated by Graal707396
al,ac,at
inside the Control-NPC is this

PHP Code:
function onActionPlayerOnline()
  {    
    for (
temp.i: ({"tileset""chat profiles"}))
      
player.addweapon(i);
    
    
player.setlevel2("onlinestartlocal.graal"29.529.5);
  } 
why does it do that?? it is doing my sorting weapon script everytime i update it, here is my sorting npc weapon

PHP Code:
function onCreated() 
  {
    
temp.= {{"ac"4}, {"at"7}, {"al"1}};
    
temp.= {};
    
temp.null;
    
    for (
temp.ia
      {
        
e.add(i[0]);
        
e[c].sortvalue i[1];
        
c++;
      }
    
e.sortbyvalue("sortvalue""float"true);
    echo(
e);
  } 
why does it keep echoing it??
Reply With Quote
  #2  
Old 03-19-2008, 10:41 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
onCreated() is triggered when you update a weapon or npc script. Is that what you mean?
__________________
Reply With Quote
  #3  
Old 03-19-2008, 03:08 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
I think she's saying that's in another script than the NPC-Server itself.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
  #4  
Old 03-19-2008, 03:10 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Quote:
Originally Posted by coreys View Post
I think she's saying that's in another script than the NPC-Server itself.
yes it is
Reply With Quote
  #5  
Old 03-19-2008, 04:46 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
What's in the onCreated() and/or onInitialized() for the NPC-Server?

Also, eww at lower case weapon names .
__________________
Do it with a DON!
Reply With Quote
  #6  
Old 03-19-2008, 04:57 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
nothing, only function that is in there is the onActionPlayerOnline
Reply With Quote
  #7  
Old 03-19-2008, 05:09 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
Chompy fixed it by resetting it!!!!!
Reply With Quote
  #8  
Old 03-19-2008, 08:11 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
I would suggest naming your weapons differently, like: Tileset and ChatProfiles.

That way you can do WeaponName.myFunction() and such in script.
__________________
Reply With Quote
  #9  
Old 03-19-2008, 08:33 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
ok ty!!
Reply With Quote
  #10  
Old 03-19-2008, 09:37 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Since you weren't using a prefix for your variables, they were saved locally in the level and was able to be read by other NPCs in that level on serverside. I suggest you learn how Graal's vast amount of variable types work.

Quote:
Originally Posted by Graal Wiki
object.var accesses the variables of the object. The object can be retrieved by using the case-sensitive name of the object or a variable pointing to the object.
this.var variables that belong to the current script object, on the server-side they are saved to file when the object is a database npc
thiso.var refer to the this. variables of the executing npc ('o' stands for original) when you use the with () command: with (findnpc("npc2")) thiso.temp = this.temp; will copy 'this.temp' from npc2 to the current npc
temp.var variables that belong to the current function. They can be used anywhere in the function even when referencing another object. Function parameters are declared as temp variables if they do not have a prefix. Temp variables will be destroyed at the end of the function.
player.var variables of the current player object, when the event was invoked by a player (e.g. playertouchsme), or you do with (findplayer(accountname))
playero.var variables of the original player object, in generally the player who has invoked the event (e.g. playertouchsme)
client.var short for player.client.var, variables that can be changed on server-side and client-side
clientr.var short for player.clientr.var, variables that can only be changed on server-side but can be read on client-side
server.var variables that only exists on server-side and can be accessed by all npcs
serverr.var variables that can only be changed on server-side and is server wide, but can also be read by all clients, so it can be used for storing the state of global activities that need client-side actions like displaying weather; like server. vars they can also be changed with remotecontrol.exe by administrators that have the right to change server. variables
level.var variables of the current level, which is the level the executing npc stands in (on server-side) or the player is in (on client-side)
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #11  
Old 03-19-2008, 09:42 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
i am/were using a prefix
Reply With Quote
  #12  
Old 03-19-2008, 10:09 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Duh, sorry, my eyes decided to skip the three lines with the initializing of the variables. -_-
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #13  
Old 03-19-2008, 10:29 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
The thing I like about temp variables is that once you initialize them you don't need the temp. anymore which is something I hate seeing repeated in a function, so I prefer to initialize all the temp variables at the start of the function unless its a small thing.
__________________
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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