[Help] General C# menu

Shout-Out

User Tag List

Results 1 to 5 of 5
  1. #1
    snigelmannen's Avatar Member
    Reputation
    27
    Join Date
    Jul 2007
    Posts
    318
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Help] General C#

    Okay as stated, im not a coder

    But if i want to place the progressBar1.Value = HPPer; outside the try-catch, what do i have to do?

    Code:
    namespace SnigelStatusLive
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
    
            }
    
            private void timer1_Tick(object sender, EventArgs e)
            {
                BlackMagic WoW = new BlackMagic();
                
                try
                {
                    uint PlayerBase = WoW.ReadUInt(WoW.ReadUInt(WoW.ReadUInt(0x00CF7C00) + 0x34) + 0x24);
                    uint CurHealth = WoW.ReadUInt(WoW.ReadUInt(PlayerBase + 0x8) + (0x17 * 4));
                    uint MaxHealth = WoW.ReadUInt(WoW.ReadUInt(PlayerBase + 0x8) + (0x1F * 4));
                    int HPPer = (int)(((double)CurHealth / (double)MaxHealth) * 100);
                    progressBar1.Value = HPPer;
                }          
                catch (Exception SProcess)
                {
                    FileStream file = new FileStream("Error.txt", FileMode.OpenOrCreate, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(file);
                    sw.Write(SProcess);
                    sw.Close();
                    file.Close();
                }   
            }
        }
    }
    " Spy sappin mah sentry! "

    [Help] General C#
  2. #2
    Murdok's Avatar Member
    Reputation
    34
    Join Date
    Oct 2007
    Posts
    69
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure if i get what your saying exactly but i think i know, try using the finally statement as it is run no matter what happens inside the Try-Catch so like

    Code:
                try
                {
                    uint PlayerBase = WoW.ReadUInt(WoW.ReadUInt(WoW.ReadUInt(0x00CF7C00) + 0x34) + 0x24);
                    uint CurHealth = WoW.ReadUInt(WoW.ReadUInt(PlayerBase + 0x8) + (0x17 * 4));
                    uint MaxHealth = WoW.ReadUInt(WoW.ReadUInt(PlayerBase + 0x8) + (0x1F * 4));
                    int HPPer = (int)(((double)CurHealth / (double)MaxHealth) * 100);
                    progressBar1.Value = HPPer;
                }          
                catch (Exception SProcess)
                {
                    FileStream file = new FileStream("Error.txt", FileMode.OpenOrCreate, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(file);
                    sw.Write(SProcess);
                    sw.Close();
                    file.Close();
                }  
                finally
                {
                    progressBar1.Value = HPPer;  
                }
    Is this what you ment?

    There are 10 kinds of people in the world. Those who understand binary and those who don't.

  3. #3
    snigelmannen's Avatar Member
    Reputation
    27
    Join Date
    Jul 2007
    Posts
    318
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ye pretty much, will test that later, thanks for the help +Rep
    " Spy sappin mah sentry! "

  4. #4
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm pretty sure that won't work. You can't use a variable from another scope.

    Try this instead:

    Code:
                BlackMagic WoW = new BlackMagic();
                int HPPer = 0;
     
                try
                {
                    uint PlayerBase = WoW.ReadUInt(WoW.ReadUInt(WoW.ReadUInt(0x00CF7C00) + 0x34) + 0x24);
                    uint CurHealth = WoW.ReadUInt(WoW.ReadUInt(PlayerBase + 0x8) + (0x17 * 4));
                    uint MaxHealth = WoW.ReadUInt(WoW.ReadUInt(PlayerBase + 0x8) + (0x1F * 4));
                    HPPer = (int)(((double)CurHealth / (double)MaxHealth) * 100);
                }          
                catch (Exception SProcess)
                {
                    FileStream file = new FileStream("Error.txt", FileMode.OpenOrCreate, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(file);
                    sw.Write(SProcess);
                    sw.Close();
                    file.Close();
                }
                finally
                {
                    progressBar1.Value = HPPer;
                }
    Why do I need a signature?

  5. #5
    snigelmannen's Avatar Member
    Reputation
    27
    Join Date
    Jul 2007
    Posts
    318
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, ye well im not coder just know copy pasta but will try it soon
    " Spy sappin mah sentry! "

Similar Threads

  1. Lua script help and general questions from beginner
    By WinKIller0 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 02-23-2008, 04:38 AM
All times are GMT -5. The time now is 04:11 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search