Help Dialog Style 0 new line

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
When I show a DIALOG_STYLE_MSGBOX (id 0) the "\n" character has no effect on the text and just shows up as part of the text. I am trying to take a new line. All other special characters such as "\r" and "\t" do not work either. However, "\n" works perfectly for me in a DIALOG_STYLE_LIST (id 2). Does anyone know how to correctly take a new line in a messagebox dialog?
 

MrChristmas

Expert
Joined
Jul 29, 2014
Messages
563
Reaction score
26
Hidend link said:
[member=26707]HenryTeylor[/member] is a master with dialogs, maybe will help you

You don't know the power of [member=60]Opcode.eXe[/member]

Don't estimate the power of the [member=2]0x688[/member]
 

HenryTeylor

Active member
Joined
Sep 13, 2014
Messages
33
Reaction score
0
mrT101 link said:
When I show a DIALOG_STYLE_MSGBOX (id 0) the "\n" character has no effect on the text and just shows up as part of the text. I am trying to take a new line. All other special characters such as "\r" and "\t" do not work either. However, "\n" works perfectly for me in a DIALOG_STYLE_LIST (id 2). Does anyone know how to correctly take a new line in a messagebox dialog?

4MZ2VCx.png


20 - Space
A - end of line
00 - symbol reserved for terminating NULL (C-string).

Code:
{$CLEO}
thread "HenryTeylor"

if not 0@ = SAMP.Base()
then 0A93: end_custom_thread
end

while not SAMP.Available()
wait 100
end

while true
wait 0
    if 0AB0: key_pressed 0x31 // 1
    then
        0AC6: 0@ = label [member=23507]Label[/member] offset
        0B3B: samp show_dialog id 2 caption "Dialog Test" text 0@ button_1 "Yes" button_2 "No" style 0
    end
end

:label

hex
"{FF0000}TestOne:" 20 "TextOne" A
"{FF0000}TestTwo:" 20 "TextTwo" A
"{FF0000}TestThree:" 20 "TextThree" A
"{FF0000}TestFour:" 20 "TextFo" 00
end

RKf4suI.png


Code:
{$CLEO}

wait 0

if not 0@ = samp.Base()
then 0a93:
end
while not samp.Available()
wait 100
end

0AC8: 0@ = allocate_memory_size 1260
0AC8: 5@ = allocate_memory_size 1260


while true
wait 0
if 0ab0: 49
then
//Function to create a dialog text
  call @readStringFromList 2 list @patcheslist string_number 0 to 3@
  0AD3: string 0@ format "%s" 3@
  for 1@ = 1 to 3 // 3 is the number of rows, counting from zero in @patchelist
  call @readStringFromList 2 list @patcheslist string_number 1@ to 3@
  0AD3: string 5@ format "%s%c%s" 0@ 10 3@
  0AD3: string 0@ format "%s" 5@
end
0B3B: samp show_dialog id 2 caption "Example" text 5@ button_1 "Ok" button_2 "" style 0
wait 1000
end
end

:readStringFromList
var
1@ : int
2@ : int
end

0AC6: 0@ = label 0@ offset
0@ += 4
2@ = 0
while 2@ < 1@
3@ = 1
while 3@ <> 0
0A8D: 3@ = read_memory 0@ size 1 virtual_protect 0
inc(0@)
end
0@ += 3
inc(2@)
end

ret 1 0@

:patcheslist //Here is your text, each line begins with 0900
0900: "Method by FYP"
0900: "TextOne"
0900: "TextTwo"
0900: "Special ugbase.eu"
0000:
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,488
Reaction score
231
Location
( ͡° ͜ʖ ͡°)
0AC8: 0@ = allocate_memory_size 260
0AD3: 0@ = "First line %c Second line %c Third line %c" 0xA 0xA 0xA
0@ is now like:
First line
Second line
Third line
0AC9: free_allocated_memory 0@
 

mrT101

Active member
Joined
Feb 18, 2014
Messages
58
Reaction score
0
Thanks [member=26707]HenryTeylor[/member] and [member=60]Opcode.eXe[/member] ! . Got it working now
 
Top