offsets to textbox

Post here about scripting and programming for HaloPC (audio, network, ai, etc.)
Post Reply
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

offsets to textbox

Post by spikes122 »

hey

im using vb 06

i was wondering how i could write a offsets value (convert to asci first)
into a text box in vb.
OwnZ joO




Articulatist 500

Posts: 980
Joined: Thu Nov 10, 2005 4:24 pm

Post by OwnZ joO »

well you can say

Code: Select all

txtOffsetTextBox.Text = offset.ToString() if you want it in decimal if I remember right
txtOffsetTextBox.Text = offset.ToString("X") if you want it in hex I think
User avatar
Prey




Connoisseur Snitch! Pyre Articulatist 500

Posts: 1026
Joined: Wed Dec 27, 2006 6:49 am
Location: UK
Contact:

Post by Prey »

I understand vb06 differs from 2005.. but I'm unsure if that would be correct OwnZ, heres what would work in 2005

Code: Select all

txtOffsetTextBox.Text = offset 'Display the integer as is
txtOffsetTextBox.Text = Hex(offset) 'Display the base 16 conversion of the integer
Edit* After re-reading your post it seems you want the value from the current position of the reader in the stream, again 2005 code here (also assuming you initialized your reader and it is at the correct position)

Code: Select all

txtOffsetTextBox.Text = reader.ReadInt32() 'Will read the integer at the current position in the current stream
Halo 2 Prophet - Skin with ease with the simple 3D point and click interface.
Halo 3 Research Thread - Contribute to the research into Halo 3.
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Post by spikes122 »

hmmm so ok so say if i had the offsets
11111111 = o
and 22222222=k
in vb 06
how would i put that into one box
im not very gd at vb memory

thanks
OwnZ joO




Articulatist 500

Posts: 980
Joined: Thu Nov 10, 2005 4:24 pm

Post by OwnZ joO »

spikes122 wrote:hmmm so ok so say if i had the offsets
11111111 = o
and 22222222=k
in vb 06
how would i put that into one box
im not very gd at vb memory

thanks
I'm pretty sure you have it backwards

you meant:

Code: Select all

int o = 11111111
right?

well it would be:

Code: Select all

txtOffsetTextBox.Text = o.ToString()
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Post by spikes122 »

hmmmm ok
thanks
so ok if my offset was 1111111 and value was a

so where would i put the offset and the value of a in this line of code

txtOffsetTextBox.Text = o.ToString()

thanks
OwnZ joO




Articulatist 500

Posts: 980
Joined: Thu Nov 10, 2005 4:24 pm

Post by OwnZ joO »

if your variable name(value) is a then it would be a.ToString() instead of o.ToString()
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Post by spikes122 »

well what i mean is in halos memory theres offsets for a players name
so thse offsets have a value like 87
so i want to convert 87 to asci then into textbox
so say if the value 87=s
then my textbox would display s

thanks if i can get it to work ill give u credit
OwnZ joO




Articulatist 500

Posts: 980
Joined: Thu Nov 10, 2005 4:24 pm

Post by OwnZ joO »

ok to give a variable a value you need to put the value on the right side of the equal sign.

So you need to make it s = 87 not 87 = s

then you need to do this
textbox.Text = s.ToString()

this code would be for displaying 87 in the textbox, not the value at offset 87, you would need to have a binaryreader for that
User avatar
Prey




Connoisseur Snitch! Pyre Articulatist 500

Posts: 1026
Joined: Wed Dec 27, 2006 6:49 am
Location: UK
Contact:

Post by Prey »

VB handles the conversions, thus you don't need to have the .ToString()'s and thus you won't have to convert the value once read,

Code: Select all

dim Value as Integer = 'Read the value here
TextBox1.Text = Value
Simple as that, also Spike if you could learn to grasp the English language a little better it would be most appreciated; it is quite tiresome to read dribble.
Halo 2 Prophet - Skin with ease with the simple 3D point and click interface.
Halo 3 Research Thread - Contribute to the research into Halo 3.
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Post by spikes122 »

im still not really sure
so my ffset for the first letter of the players name is 1111111 so the offset has a value of 87 but i want to convert it text into the textbox
dim Value as Integer = 'Read the value here
TextBox1.Text = Value
so in that would i juust write the offset after integer part
its just i cant write the value myself because it changes for each server i make so it needs to get the players name offset and convert to text into the textbox so i can see every players names
and lol its because i was typing fast
User avatar
Prey




Connoisseur Snitch! Pyre Articulatist 500

Posts: 1026
Joined: Wed Dec 27, 2006 6:49 am
Location: UK
Contact:

Post by Prey »

Post the code that you use to open up the map in a reader and seek to your specific '111..' offset.
Halo 2 Prophet - Skin with ease with the simple 3D point and click interface.
Halo 3 Research Thread - Contribute to the research into Halo 3.
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Post by spikes122 »

would it be easyier to do this in c++ or C?
spikes122





Posts: 292
Joined: Thu Dec 21, 2006 7:44 am

Post by spikes122 »

ok thanks for your help ive managed to get it to read the value into a textbox
however its not text asci
its just -193
how would i convert it to teh asci string view
thanks
OwnZ joO




Articulatist 500

Posts: 980
Joined: Thu Nov 10, 2005 4:24 pm

Post by OwnZ joO »

BinaryReader.ReadChar() returns a char

You can make a new String out of a char or chars

so:

Code: Select all

Dim br As BinaryReader =  new BinaryReader(new FileStream(file))
Dim c As char = br.ReadChar()
Dim s As String = new String(c)
That's how I would do it in C# converted to vb, Not sure if it works exactly like that in VB
You could try just sending the char into the textbox.Text, maybe vb converts it for you.
Post Reply