Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-07-2006, 03:20 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
String being added twice

The 'exp' portion of the code is adding the string twice..

PHP Code:
function CompleteQuest(acc) {
  
temp.reference findplayer(acc);
  for (
temp.0temp.this.questinfo.reward.size(); temp.a++) {
    if (
this.questinfo.reward[temp.a] == "gold") {
      
temp.reference.rupees += this.questinfo.reward[temp.a+1];
      
temp.reference.client.temp_addmessages.add("You gain" SPC this.questinfo.reward[temp.a+1SPC "gold.");
    }
    else if (
this.questinfo.reward[temp.a] == "item") {
      
temp.ivars.loadvars("levels/archetype/" this.questinfo.reward[temp.a+1] @ ".arc");
      
temp.reference.AddItem(temp.ivars.wname,this.questinfo.reward[temp.a+1],this.questinfo.reward[temp.a+2]);
      
temp.reference.client.temp_addmessages.add("You gain" SPC temp.ivars.wname SPC "x" this.questinfo.reward[temp.a+2] @ ".");
    }
    else if (
this.questinfo.reward[temp.a] == "exp") {
      
temp.reference.client.temp_addmessages.add("You gain" SPC this.questinfo.reward[temp.a+1SPC "EXP.");
      
temp.reference.AddEXP(this.questinfo.reward[temp.a+1]);
    }
  }

Reply With Quote
  #2  
Old 09-07-2006, 04:25 AM
KuJi KuJi is offline
Banned
Join Date: Apr 2004
Location: Staten Island, New York
Posts: 2,202
KuJi will become famous soon enough
Send a message via ICQ to KuJi Send a message via AIM to KuJi Send a message via MSN to KuJi Send a message via Yahoo to KuJi
Quote:
Originally Posted by Yen
The 'exp' portion of the code is adding the string twice..

PHP Code:
function CompleteQuest(acc) {
  
temp.reference findplayer(acc);
  for (
temp.0temp.this.questinfo.reward.size(); temp.a++) {
    if (
this.questinfo.reward[temp.a] == "gold") {
      
temp.reference.rupees += this.questinfo.reward[temp.a+1];
      
temp.reference.client.temp_addmessages.add("You gain" SPC this.questinfo.reward[temp.a+1SPC "gold.");
    }
    else if (
this.questinfo.reward[temp.a] == "item") {
      
temp.ivars.loadvars("levels/archetype/" this.questinfo.reward[temp.a+1] @ ".arc");
      
temp.reference.AddItem(temp.ivars.wname,this.questinfo.reward[temp.a+1],this.questinfo.reward[temp.a+2]);
      
temp.reference.client.temp_addmessages.add("You gain" SPC temp.ivars.wname SPC "x" this.questinfo.reward[temp.a+2] @ ".");
    }
    else if (
this.questinfo.reward[temp.a] == "exp") {
      
temp.reference.client.temp_addmessages.add("You gain" SPC this.questinfo.reward[temp.a+1SPC "EXP.");
      
temp.reference.AddEXP(this.questinfo.reward[temp.a+1]);
    }
  }

Did you try to debug it?
Try echoing this.questinfo.reward.size() at the top of the script.

If it returns it twice, that means two things are triggering to it - if thats > 1 that can also be why (just a thought)
Reply With Quote
  #3  
Old 09-07-2006, 04:51 AM
ChibiChibiLuc ChibiChibiLuc is offline
Cookie Monster. :3
Join Date: Jan 2005
Location: Nova Scotia, Canada
Posts: 111
ChibiChibiLuc is on a distinguished road
Send a message via AIM to ChibiChibiLuc Send a message via MSN to ChibiChibiLuc
The EXP is only being added once, the function is only being called once, the item is only being called once, everything is only being called once.
I've debugged everything relating to it. I've even tried changing the order of operation.
Reply With Quote
  #4  
Old 09-07-2006, 08:43 AM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Show the AddEXP function.
And an example of what this.questinfo.reward is set to.
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #5  
Old 09-07-2006, 10:25 PM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
Quote:
Originally Posted by contiga
Show the AddEXP function.
And an example of what this.questinfo.reward is set to.
Neither are the problem.
Reply With Quote
  #6  
Old 09-09-2006, 05:36 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
It must be AddEXP though?
Reply With Quote
  #7  
Old 09-09-2006, 06:20 PM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Just show that string and function, I'm sure it must be in there.
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
Reply


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:23 PM.


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