Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-05-2017, 04:56 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,729
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
Script ignoring if statement conditions?

This is a small sample of a larger script I wrote.

Graal Script Code:
if (this.item in db_quests.items3) {
  
temp.prefix FindPrefix();
  if (
temp.prefix == -1) {
    echo(
"Level not found in quest database");
  }
  else {
    
// CODE
  
}
}

// find NPC level prefix then check if it is in the quest database
function FindPrefix() {
  for (
temp.a=0;temp.a<=this.level.length();temp.a++) {
    
temp.search this.level.substring(temp.a,1);
    if (
temp.search == "_") {
      
temp.checkprefix this.level.substring(0,temp.a);
      if (
temp.checkprefix in db_quests.quests) {
        return 
temp.checkprefix;
      }
      else return -
1;
    }
  }

The problem is the if statement temp.prefix == -1 in the first block of code. Despite findPrefix returning a value not equal to -1 (verified by echo) it will activate regardless and the else statement will be ignored. Any ideas as to why?
__________________
Save Classic!
Reply With Quote
 

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:40 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.