Thread: problem with screenfade

Results 1 to 5 of 5
  1. #1 problem with screenfade 
    Registered Member
    Join Date
    May 2019
    Posts
    24
    Thanks given
    9
    Thanks received
    7
    Rep Power
    36
    Hi, i'm trying use screenfade but it's not working for some reason.
    server-side
    Code:
    player.getPA().sendScreenFade("Welcome to Zulrah's shrine", 1, 5);
    Code:
    	public void sendScreenFade(String text, int state, int seconds) {
    		if (c == null || c.getOutStream() == null) {
    			return;
    		}
    		if (seconds < 1 && state != 0) {
    			throw new IllegalArgumentException("The amount of seconds cannot be less than one.");
    		}
    		c.getOutStream().createFrameVarSize(9);
    		c.getOutStream().writeString(text);
    		c.getOutStream().writeByte(state);
    		c.getOutStream().writeByte(seconds);
    		c.getOutStream().endFrameVarSize();
    	}
    client-side
    Code:
    				case 9:
    					String text = inStream.readString();
    					byte state = inStream.readSignedByte();
    					byte seconds = inStream.readSignedByte();
    					fadingScreen = new FadingScreen(text, state, seconds);
    					incomingPacket = -1;
    					return true;
    Code:
    package com.client.graphics;
    
    import org.apache.commons.lang3.time.StopWatch;
    
    import com.client.DrawingArea;
    import com.client.RSFont;
    
    public class FadingScreen {
    	public RSFont newRegularFont;
    	//private FadingScreen fadingScreen = new FadingScreen();
    	/**
    	
         * The state of the fade on the screen
         */
    	public byte state;
        
        /**
         * How many seconds the fade exists for
         */
    	public byte seconds;
        
        /**
         * The string of text that will be displayed on the screen
         */
    	public String text;
        
        /**
         * Controls how long it's been since the screen started its last fade
         */
    	public StopWatch watch;
        
        /**
         * Acts as a means to instance the local {@link FadingScreen} object.
         * Since the value of state by default is 0, nothing will be drawn on
         * the screen.
         */
    	public FadingScreen() { }
        
        /**
         * Creates a new fading screen
         * @param state        the state of the fade
         * @param seconds    the duration of the fade
         */
        public FadingScreen(String text, byte state, byte seconds) {
            this.text = text;
            this.state = state;
            this.seconds = seconds;
            this.watch = new StopWatch();
            this.watch.start();
        }
        
        /**
         * Draws the animation on the screen. If the state of the
         * screen is currenly 0 the animation will not be drawn.
         */
        public void draw() {
            if(state == 0) {
                return;
            }
            long end = watch.getStartTime() + (1000L * seconds);
            long increment = ((end - watch.getStartTime()) / 100);
            if (increment > 0) {
                long percentile = watch.getTime() / increment;
                int opacity = (int) ((percentile * (Byte.MAX_VALUE / 100)) * 2);
                if (state < 0) {
                    opacity = 255 - opacity;
                }
                if (percentile > -1 && percentile <= 100) {
                    DrawingArea.setDrawingArea(334, 0, 512, 0);
                    DrawingArea.drawAlphaBox(0, 0, 512, 334, 0x000000, opacity);
                    if (percentile > 85 && state == 1 || percentile < 50 && state == -1) {
                        newRegularFont.drawCenteredString(text, 512 / 2, 334 / 2, 0xFFFFFF, 0);
                    } else if (percentile == 100) {
                        watch.stop();
                        state = 0;
                    }
                }
            }
        }
    }
    anyone idea? thanks in advance.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    May 2019
    Posts
    24
    Thanks given
    9
    Thanks received
    7
    Rep Power
    36
    bump
    Reply With Quote  
     

  3. #3  
    Rune-Server Affiliate

    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,196
    Thanks received
    1,597
    Rep Power
    5000
    are u calling fadingScreen.draw anywhere in client class?
    [Today 01:29 AM] RSTrials: Nice 0.97 Win/Loss Ratio luke. That's pretty bad.
    [Today 01:30 AM] Luke132: Ok u fucking moron i forgot i could influence misc.random
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. Thankful user:


  5. #4  
    I need some more coffee

    Jason's Avatar
    Join Date
    Aug 2009
    Age
    26
    Posts
    6,101
    Thanks given
    2,384
    Thanks received
    2,798
    Rep Power
    4393
    Hey looks its my sheet code Make sure FadingScreen#draw is being called somewhere in the client class. What are you sending as the 'state' value? If it's 0, then that just resets it.
    Reply With Quote  
     

  6. Thankful user:


  7. #5  
    Registered Member
    Join Date
    May 2019
    Posts
    24
    Thanks given
    9
    Thanks received
    7
    Rep Power
    36
    Quote Originally Posted by Jason View Post
    Hey looks its my sheet code Make sure FadingScreen#draw is being called somewhere in the client class. What are you sending as the 'state' value? If it's 0, then that just resets it.
    Hahaa yes it is yours , yeah forgot the call the draw. Thank you
    Reply With Quote  
     

  8. Thankful user:



Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. The problem with the community.
    By Mint in forum Complaints
    Replies: 10
    Last Post: 01-27-2008, 11:00 PM
  2. Problem....With Recoloring..
    By Wiffles in forum RS2 Client
    Replies: 0
    Last Post: 12-30-2007, 09:19 AM
  3. Problem With My Shop!!
    By 1337scape in forum RS2 Server
    Replies: 0
    Last Post: 09-15-2007, 05:53 PM
  4. Replies: 10
    Last Post: 08-31-2007, 10:41 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •