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 12-12-2012, 02:48 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Loses temp value

I can't for the life of me figure out, or know, why this temp.message var loses its array value.... the first player.chat shows up perfectly fine, but the player.chat marked under // HERE is empty. The script does make it to that spot just fine.

PHP Code:
  // clear all images
  
player.chat message[0][0];
  
clearImages();
  
  
// set vars
  
this.conReturn conReturn;

  
// make player still
  
setani("idle"null);
  
disabledefmovement();
  
  
// move in stuff
  
tweenInHead(head);
  
tweenInName(speaker);
  
  if (
conReturn)
  {
    
// HERE
    
player.chat message[0][0];

    
tweenInMessage(message[0][0]);
    for (
temp.0message[0].size() - 1t++)
    {
      
tweenInChoices(message[0][i]);
    }
    
this.messageWaiting true;
  }else
  {
    
tweenInMessage(message);
  }
  
tweenInBG();
  
  
// set to show it's shown up and wait for interaction
  
this.shown true
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 12-12-2012, 03:04 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Use the temp. prefix (temp.message) throughout your code (not just message) and see if you still have the same issues. message is also a function so I would probably replace it with msg just so it's not potentially conflicting.
__________________
Quote:
Reply With Quote
  #3  
Old 12-12-2012, 03:25 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Not sure if it's exactly related, but I've reported similar problems:

http://forums.graalonline.com/forums...05#post1514105
Reply With Quote
  #4  
Old 12-12-2012, 03:48 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
fowlplay: From my experience proper syntax is temp.var, and I typically initialize the temp.var as so, but nothing so far has stopped it from working as long as its a local var. Although, I went and changed all of them, and changes message to msg and it still isn't working at all....

Dusty: Pretty much the same thing probably. It's just odd because at first I had this, not sending an array through but just single var to the public funciton

PHP Code:
tweenInMessage(temp.msg); 
and it worked fine and sent. Now it's an array, and sub array inside, and it's not working with the if's and such.

Really, really annoying.... anyone else have any other ideas. To explain a little deeper a level npc is just sending the information to this (might as well put updated anyways):

PHP Code:
public function loadDialog(temp.conReturntemp.speakertemp.headtemp.msg)
{
  
// clear all images
  
clearImages();
  
// THIS PLAYER CHAT HAS THE CORRECT VALUE FROM THE ARRAY
player.chat temp.msg[0][0];

  
// set vars
  
this.conReturn temp.conReturn;
  
  
// make player still
  
setani("idle"null);
  
disabledefmovement();
  
  
// move in stuff
  
tweenInHead(temp.head);
  
tweenInName(temp.speaker);
  
  if (
this.conReturn)
  {
    
// THIS PLAYER CHAT RESULTS IN A 0
    
player.chat temp.msg[0][0];
    
tweenInMessage(temp.msg[0][0]);
    for (
temp.0temp.msg[0].size() - 1t++)
    {
      
tweenInChoices(temp.msg[0][i]);
    }
    
this.messageWaiting true;
  }else
  {
    
tweenInMessage(temp.msg);
  }
  
tweenInBG();
  
  
// set to show it's shown up and wait for interaction
  
this.shown true;

This section seems to be the issue:
PHP Code:
if (this.conReturn)
  {
    
player.chat temp.msg[0][0];
    
tweenInMessage(temp.msg[0][0]);
    for (
temp.0temp.msg[0].size() - 1t++)
    {
      
tweenInChoices(temp.msg[0][i]);
    }
    
this.messageWaiting true;
  }else
  {
    
tweenInMessage(temp.msg);
  } 
Just doing
PHP Code:
tweenInMessage(temp.msg
with a single var sent works fine, sending an array gets lost in the if statement.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #5  
Old 12-12-2012, 03:55 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Have you been able to isolate it beyond that? (e.g. if you comment out the tweens, does it work?) My guess would be a sleep in the tweens is doing something odd.

Also, I would always avoid using "message" as a variable name. I've had problems with that forever.
__________________
Reply With Quote
  #6  
Old 12-12-2012, 04:04 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Compare the top to the one I'm trying to make work. This works when NOT sending an array to it.

PHP Code:
public function loadDialog(temp.conReturntemp.speakertemp.headtemp.msg)
{
  
// clear all images
  
clearImages();

  
// set vars
  
this.conReturn temp.conReturn;
  
  
// make player still
  
setani("idle"null);
  
disabledefmovement();
  
  
// move in stuff
  
tweenInHead(temp.head);
  
tweenInName(temp.speaker);
  
tweenInMessage(temp.msg);
  
tweenInBG();
  
...... 
This is the script using to send as single (the true/false is just my way of saying if its an array or not, doesn't seem to be effecting the code whatsoever):

PHP Code:
  temp.speaker "Billy";
  
temp.head this.head;
  
temp.message "I'm really bored and have no idea what to do...";

  
// send false for single message or true for multiple
  
temp.response findweapon("-System/NPCDialog").loadDialog(falsespeakerheadmessage); 
Sending as array and not working:

PHP Code:
  temp.speaker "Billy";
  
temp.head this.head;
  
temp.msg.add({"I'm really bored and have no idea what to do...","So?""Go swimming!""I hate you"});
  
temp.msg.add({"Whatever dude...""I can't swim""We share that feeling now"});

  
// send false for single message or true for multiple
  
temp.response findweapon("-System/NPCDialog").loadDialog(truespeakerheadmsg); 

So it's not the tween. I don't think it's the way I'm sending an array or the fact that I am sending an array or not because it worked where I marked in the previous post in comments which chat showed it, then 10 lines down it's lost.

I just don't get this. Tried everything I can think of.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #7  
Old 12-12-2012, 04:27 AM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
This worked. Had to just assign it separate and correctly into this.vars

PHP Code:
public function loadDialog(temp.conReturntemp.speakertemp.headtemp.msg)
{
  
// clear all images
  
clearImages();
  
  
// set vars
  
this.conReturn conReturn;
  
this.msgFull temp.msg[0].size();
  
this.msg temp.msg[0][0];
  
  for (
temp.1temp.temp.msg[0].size(); i++)
  {
    
this.options.add(temp.msg[0][i]);
  }
  
//player.chat = this.options;
  
  // make player still
  
setani("idle"null);
  
disabledefmovement();
  
  
// move in stuff
  
tweenInHead(temp.head);
  
tweenInName(temp.speaker);
  
  if (
this.conReturn)
  {
    
//player.chat = this.options;
    
tweenInMessage(this.msg);
    for (
temp.0temp.this.msgFull 1temp.j++)
    {
      
tweenInChoices(this.options[j]);
    }
    
this.messageWaiting true;
  }else
  {
    
tweenInMessage(temp.msg);
  }
  
tweenInBG();
  
  
// set to show it's shown up and wait for interaction
  
this.shown true;


That's still bs imo. Local vars should be able to work as far as I can see. All well. If someone notices something to teach me or something I did wrong please note so I can switch it back to local vars.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #8  
Old 12-12-2012, 07:47 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
What you're referring to as 'temp vars' are the function parameters, and if your system uses waitfor/sleep that can make those disappear for some reason (as you found out) so you need to store them.
__________________
Quote:
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 01:05 AM.


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