Jump to content

Photo

Reset Quest?


  • Please log in to reply
17 replies to this topic

#16 Elmensajero

Elmensajero

    Doyen(ne)

  • Members
  • Real Name:John
  • Location:Raleigh, North Carolina

Posted 21 January 2009 - 11:42 PM

Bugs:
  • int cycle; - Again, variables can't be declared in this location. Move it down inside the "void run()" function.
  • const int ... - Constants must be defined globally, outside of any functions, in ZScript. So move all of the constant declarations to the top of the script to fix it.
  • Game->Lkeys[i] = 0; - Capitalize the "k" in "Lkeys"
  • bool[255] items; - Arrays are declared with the size located after name. So, you would use "bool items[255];" instead.
  • void Run() - ZScript is case-sensitive, so don't forget to lowercase the "r" so it becomes "void run()"
A minor thing that you could reduce is the following:
CODE
                     //Reset Link's inventory
                     if(resetI == 1)
                     {
                         for(int i; i <255; i++)
                         {
                              if (items[i] == true)
                              {

                              }
                              else
                              {
                                 Link->Item[i] = false;
                              }
                         }
                     }

could be reduced to:
CODE

                     //Reset Link's inventory
                     if(resetI == 1)
                     {
                         for(int i; i <255; i++)
                         {
                              if (items[i] == false) Link->Item[i] = false;
                         }
                     }

Not really necessary, but gets rid of unnecessary code.

So, I still have not tested this, only fixed compile-time errors so far. I might have some time tomorrow to mess around with it, though I think Sat. after work will be the first chance I have to check for "algorithmic errors".

Edited by Elmensajero, 21 January 2009 - 11:44 PM.


#17 SpacemanDan

SpacemanDan

  • Members
  • Location:Ontario, Canada

Posted 22 January 2009 - 08:59 AM

QUOTE(Elmensajero @ Jan 21 2009, 11:42 PM) View Post

int cycle; - Again, variables can't be declared in this location. Move it down inside the "void run()" function.
I thought you could declare a variable here for it to be regarded as a global variable. Or would I have to put it in a global script?

[b]const int ...
- Constants must be defined globally, outside of any functions, in ZScript. So move all of the constant declarations to the top of the script to fix it.
So I would put this before void run()?

Game->Lkeys[i] = 0; - Capitalize the "k" in "Lkeys"
I'm pretty bad for forgetting stuff like this.

bool[255] items; - Arrays are declared with the size located after name. So, you would use "bool items[255];" instead.
Oops. icon_sweat.gif

void Run() - ZScript is case-sensitive, so don't forget to lowercase the "r" so it becomes "void run()"
Another oops. icon_sweat.gif

Edited by Blaman, 22 January 2009 - 09:01 AM.


#18 Joe123

Joe123

    Retired

  • Members

Posted 22 January 2009 - 12:20 PM

QUOTE
I thought you could declare a variable here for it to be regarded as a global variable. Or would I have to put it in a global script?


Global variables used to be declared there.
The method has since changed, and they are now declared outside of scripts althogether.


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users