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 09-23-2011, 11:46 PM
gaben gaben is offline
uhh no
gaben's Avatar
Join Date: Aug 2011
Posts: 47
gaben is an unknown quantity at this point
writing to an npc flag from class?

i've done it before, but for some reason it just won't work properly

npc vardump:

PHP Code:
Variables dump from npc boolean

boolean
.typeSYSTEM
boolean
.scripterboolean
boolean
.levelonlinestartlocal.nw

Attributes
:
boolean.image
boolean.scriptsize0
boolean
.visibility flagsvisible
boolean
.id1014
boolean
.sprite2
boolean
.head
boolean.xprecise0
boolean
.yprecise0

this
.-Flags
boolean
.vote=12 
class:

PHP Code:
function onCreated(){
  
boolean.vote[0] = 1;
  
sendtonc(boolean.vote[0]); // outputs 12 instead of 1

help is appreciated
__________________
Quote:
Originally Posted by iBeatz View Post
Who came up with this Cheat Engine? The more I read about, the more ingenious the whole thing sounds.
Quote:
Originally Posted by Unixmad
This forums is going worst each day.
Quote:
Originally Posted by ff7chocoboknight View Post
You sure are taking your time leaving, furry.
Quote:
Originally Posted by [email protected] View Post
are u old enough 2 even play Graal little girl???
Reply With Quote
  #2  
Old 09-23-2011, 11:51 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Quote:
Originally Posted by gaben View Post
i've done it before, but for some reason it just won't work properly

npc vardump:

PHP Code:
Variables dump from npc boolean

boolean
.typeSYSTEM
boolean
.scripterboolean
boolean
.levelonlinestartlocal.nw

Attributes
:
boolean.image
boolean.scriptsize0
boolean
.visibility flagsvisible
boolean
.id1014
boolean
.sprite2
boolean
.head
boolean.xprecise0
boolean
.yprecise0

this
.-Flags
boolean
.vote=12 
class:

PHP Code:
function onCreated(){
  
boolean.vote[0] = 1;
  
sendtonc(boolean.vote[0]); // outputs 12 instead of 1

To write "vote[0]", vote would need to be initialized as an array first, such as:

PHP Code:
//boolean.vote = new[array size];
boolean.vote = new[2]; 
or

PHP Code:
boolean.vote = {NULLNULL}; 
Reply With Quote
  #3  
Old 09-24-2011, 12:04 AM
gaben gaben is offline
uhh no
gaben's Avatar
Join Date: Aug 2011
Posts: 47
gaben is an unknown quantity at this point
For whatever reason I'm having trouble just adding to the array.

PHP Code:
function onPlayerChats(){
  if(
player.chat == "/b"){
   
boolean.vote = new[boolean.vote.size() + 1]; 
   
boolean.vote[this.boolean.vote.size() + 1] = 45;
   
player.chat boolean.vote[boolean.vote.size()];
  }

Will return 45 once, the other values are NULL. Other than that, it works quite nicely.
__________________
Quote:
Originally Posted by iBeatz View Post
Who came up with this Cheat Engine? The more I read about, the more ingenious the whole thing sounds.
Quote:
Originally Posted by Unixmad
This forums is going worst each day.
Quote:
Originally Posted by ff7chocoboknight View Post
You sure are taking your time leaving, furry.
Quote:
Originally Posted by [email protected] View Post
are u old enough 2 even play Graal little girl???

Last edited by gaben; 09-24-2011 at 12:19 AM..
Reply With Quote
  #4  
Old 09-24-2011, 12:26 AM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
The new[] keyword will create a completely new array. You can't expand existing arrays with it. Also, you should use the array size minus one when assigning something to the last index/field, since it starts at 0.

Not sure if it's necessary, but I always create arrays with a dynamic size like this:
PHP Code:
temp.array = {};
temp.array = new[]; // I believe this is also possible 
You're also missing some this. prefixes in your code (that, or you got one where you don't want one).
__________________
Reply With Quote
  #5  
Old 09-24-2011, 12:27 AM
gaben gaben is offline
uhh no
gaben's Avatar
Join Date: Aug 2011
Posts: 47
gaben is an unknown quantity at this point
Haha, yeah. I'll try that.
__________________
Quote:
Originally Posted by iBeatz View Post
Who came up with this Cheat Engine? The more I read about, the more ingenious the whole thing sounds.
Quote:
Originally Posted by Unixmad
This forums is going worst each day.
Quote:
Originally Posted by ff7chocoboknight View Post
You sure are taking your time leaving, furry.
Quote:
Originally Posted by [email protected] View Post
are u old enough 2 even play Graal little girl???
Reply With Quote
  #6  
Old 09-24-2011, 03:29 PM
gaben gaben is offline
uhh no
gaben's Avatar
Join Date: Aug 2011
Posts: 47
gaben is an unknown quantity at this point
PHP Code:
  boolean.vote = {player.account};
  
player.chat boolean.vote[boolean.vote.size() - 1]; 
How would I make boolean.vote = {}; expand?
__________________
Quote:
Originally Posted by iBeatz View Post
Who came up with this Cheat Engine? The more I read about, the more ingenious the whole thing sounds.
Quote:
Originally Posted by Unixmad
This forums is going worst each day.
Quote:
Originally Posted by ff7chocoboknight View Post
You sure are taking your time leaving, furry.
Quote:
Originally Posted by [email protected] View Post
are u old enough 2 even play Graal little girl???
Reply With Quote
  #7  
Old 09-24-2011, 03:47 PM
Crow Crow is offline
ǝɔɐɹq ʎןɹnɔ
Crow's Avatar
Join Date: Dec 2006
Location: Germany
Posts: 5,153
Crow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond reputeCrow has a reputation beyond repute
You can use temp.array.add(element).
__________________

Last edited by Crow; 09-24-2011 at 04:32 PM..
Reply With Quote
  #8  
Old 09-24-2011, 04:14 PM
gaben gaben is offline
uhh no
gaben's Avatar
Join Date: Aug 2011
Posts: 47
gaben is an unknown quantity at this point
ok cool
__________________
Quote:
Originally Posted by iBeatz View Post
Who came up with this Cheat Engine? The more I read about, the more ingenious the whole thing sounds.
Quote:
Originally Posted by Unixmad
This forums is going worst each day.
Quote:
Originally Posted by ff7chocoboknight View Post
You sure are taking your time leaving, furry.
Quote:
Originally Posted by [email protected] View Post
are u old enough 2 even play Graal little girl???
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 12:41 PM.


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