Jump to content

Photo

PH Map (Not a promise!)


  • Please log in to reply
13 replies to this topic

#1 Linkus

Linkus

    .

  • Members
  • Real Name:Adam

Posted 25 February 2008 - 04:48 PM

So I've decided to try ZScript. Now that I've some experience, I'll try something that will be very helpful to everyone. Now, I've decided to try to recreate the Phantom Hourglass map, where you can mark off things and such. I'm interested in the draw functions, and try to recreate a few other things.

Now, here's what I expect to do;

First off is to attempt simply making a script that draws a line when the mouse is clicked. Next, I'll try to set up certain things, such as different colors, an eraser and Clear All function, stamps, and then place them all together in a master script that activates when you select the map (or equivalent) and press A. X and Y will switch through the features, while the mouse puts them where they belong.

On a side note though, can the mouse icon be replaced, and can the changes be saved in the DMap data?

#2 Joe123

Joe123

    Retired

  • Members

Posted 25 February 2008 - 04:59 PM

The mouse icon isn't drawn, so you'd just stick an ffc where it is.

However, scripts don't run while you open the map I'm afraid.

#3 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 25 February 2008 - 10:03 PM

Wouldn't it be possible to do by warping Link to a dmap where his items are disabled, making him invisible, and putting him on a screen that looks like a map?

#4 Mitchfork

Mitchfork

    no fun. not ever.

  • Members
  • Real Name:Mitch
  • Location:Alabama

Posted 25 February 2008 - 10:45 PM

QUOTE(russadwan @ Feb 25 2008, 09:03 PM) View Post

Wouldn't it be possible to do by warping Link to a dmap where his items are disabled, making him invisible, and putting him on a screen that looks like a map?
Yea, but... geez, that's unprofessional.


#5 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 25 February 2008 - 10:51 PM

QUOTE(Ebola Zaire @ Feb 25 2008, 07:45 PM) View Post

Yea, but... geez, that's unprofessional.

Well, it looks like it's the only way to do it.

#6 LostInHyru1e

LostInHyru1e

    Can you take me as far as PureZC?

  • Members
  • Real Name:Lost
  • Location:Refer to Screename

Posted 26 February 2008 - 12:12 AM

It looks like it's not gonna work.

Why can't scripts run while the maps are up? Shouldn't they input some sort of toggle option for that per screen?

#7 Joe123

Joe123

    Retired

  • Members

Posted 26 February 2008 - 02:34 AM

QUOTE(Ebola Zaire @ Feb 26 2008, 03:45 AM) View Post

Yea, but... geez, that's unprofessional.


It's a work-around.
In many cases, ZScript can only do things that way.

QUOTE

Why can't scripts run while the maps are up? Shouldn't they input some sort of toggle option for that per screen?

Go ask DD.
I'd put money on 'post- 2.5'

#8 Russ

Russ

    Caelan, the Encouraging

  • Administrators
  • Location:Washington

Posted 26 February 2008 - 10:47 AM

QUOTE(Joe123 @ Feb 25 2008, 11:34 PM) View Post
Go ask DD.
I'd put money on 'post- 2.5'

If you ask DD, he'll say wait unitl after 2.5. _L_ would probably want to add it, but it would go against DD's feature freeze, and we all want a stable release sometime soon.

#9 Linkus

Linkus

    .

  • Members
  • Real Name:Adam

Posted 26 February 2008 - 03:54 PM

The drawing script. Everything should be there, except that it doesn't work. Basically, its function is that the FFC follows the mouse and places a pixel where the mouse pointer is while pressing A, but the FFC won't follow the mouse.
CODE

import "std.zh"
ffc script crayon{
    //my first attempt. yay
    
    void run (){
        bool InputA;        
        int data = 645;
        int cset = 8;
        int InputMouseX;
        int InputMouseY;
        
        while (true){
            float X = InputMouseX;
            float Y = InputMouseY; //tracks mouse position
        }
        
        while (InputA == true && InputMouseX > 0 < 256 && InputMouseY > 0 < 229) {
            void PutPixel( //is this function unfinished?
            int layer = 5;
            InputMouseY->int x;
            InputMouseY->int y;
            int color = 122;
            int rx = 0;
            int ry = 0;
            int rangle = 0;
            int opacity = 128;
            )
        }            
    }
}



#10 Joe123

Joe123

    Retired

  • Members

Posted 26 February 2008 - 04:27 PM

CODE
import "std.zh"

ffc script crayon{    
    void run(){
    int x; int y;        
    int data = 645;
    int cset = 8;

    this->Data = data; this->CSet = cset;
        while(true){
            x = Link->InputMouseX; y = Link->InputMouseY;
            this->X = x; this->Y = y;
            if(Link->InputA && (x > 0 && x < 256) && (y > 0 && y < 229){
                Screen->PutPixel(5,x, y, 122, 0, 0, 0, 128);
            }
        Waitframe();
        }
    }
}


Have a go with that.
Some of things you did were rather unusual, and I've corrected them.
If you don't understand anything that I've done I'm willing to explain it, but you seem capable of working it out for yourself.

Mind though, that 'putpixel' won't stay where it is.
It'll disapear when you stop pressing A.


If you declare 'while(true){}', nothing past those brackets will ever exeute.
If you declare a 'while' loop with no 'Waitframe', the system will freeze, as it will keep looping what's within that while and the rest of the system will never run.
Perhaps the easiest way to break ZC is like this:
CODE
ffc script a{void run(){while(true){}}}

Have a go using it, hehehe....

Edited by Joe123, 26 February 2008 - 04:30 PM.


#11 Linkus

Linkus

    .

  • Members
  • Real Name:Adam

Posted 26 February 2008 - 05:00 PM

The -> items have thrown me off again. Neither the documentation nor ZScript.txt go into explaining this very well, as I now know it must be used for constants. Perhaps std.zh needs to have the "reference->variable" added in order to explain how to extract information from it...

Also, the FFC for the mouse is off. I'm going to try to fix this...

Edited by Linkus, 26 February 2008 - 05:03 PM.


#12 Joe123

Joe123

    Retired

  • Members

Posted 26 February 2008 - 05:04 PM

Oh, that's fundamental.

'->' is called a pointer.

Look at the list of commands.
It's arranged into different sections, under various headers.

The sections use the pointers with their header, ie:
'InputA' is within the 'Link' section, so you use it via 'Link->InputA'.

#13 Linkus

Linkus

    .

  • Members
  • Real Name:Adam

Posted 26 February 2008 - 05:20 PM

CODE
import "std.zh"

ffc script crayon{    
    void run(){
    int x; int y;        
    int data = 656;
    int cset = 7;

    this->Data = data; this->CSet = cset;
        while(true){
            x = Link->InputMouseX - 32; y = Link->InputMouseY - 56; //-32 and -56 somewhat corrects mouse-to-FFC disposition.
            this->X = x; this->Y = y;
            if(Link->InputA){ //boundaries unnecessary for this section. Although, the FFC disappears when the mouse leaves the screen, since it is undefined. I'll attempt to remedy this by creating separate Screen->X and Screen->Y borders.
                Screen->PutPixel(5,x, y, 2, 0, 0, 0, 128);
            }
        Waitframe();
        }
    }
}

Fixed the offset a bit. Now to keep the FFC from disappearing, which I'm sure I can fix. icon_wink.gif However, the PutPixel function still isn't working right, as the pixel is only moves with the FFC instead of staying put and placing another as it follows.

#14 Joe123

Joe123

    Retired

  • Members

Posted 26 February 2008 - 05:41 PM

Um yeah, without arrays using putpixel like that really won't be entertaning.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users