View Single Post
  #69  
Old 02-16-2014, 05:06 AM
Tim_Rocks Tim_Rocks is offline
a true gentlemen
Tim_Rocks's Avatar
Join Date: Aug 2008
Location: USA
Posts: 1,863
Tim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to beholdTim_Rocks is a splendid one to behold
Yeah, seems like you didn't format things properly..

wrong: this.ida = stats_(this.playername);
right: this.ida = (@ "stats_" @ this.playername);

wrong: DB_test.addstats(this.ida) += 1;
right: DB_test.addstats(this.ida);

Although the way you set this up was odd, here's how I would of done it.

NPC:
PHP Code:
function onPlayerTouchsMe() {
  
temp.amt DB_test.addstats(); //You could specify another amount in the parentheses. 

  
player.chat "I've touched this NPC " temp.amt " time(s).";

DB_test:
PHP Code:
function onCreated() { 
  
//this.stats_Graal1059025 =1; 
  //You really don't need the line above unless you want the stats being reset.
}

public function 
addstats(temp.amt) {
  if (
temp.amt null) {
    return 
null//We don't want negatives.
  
}

  if (
temp.amt == null) {
    
temp.amt 1;
  }
  
  return 
temp.stats this.(@ "stats_" player.account) += temp.amt;

I did notice you were mixing "stats" and "item" together. Hopefully this example works, I didn't have a chance to test it.
__________________
Reply With Quote