#1 27-06-2008 14:25

Rapier
Registered: 28-04-2008
Posts: 29

Custom Texts

Hi, I am using the following code to display text without editing the file .GXT or create files .FXT.

...
gosub @SubStrings
wait 5000
0AA5: call 0x588BE0 num_params 4 pop 4 0 0 0 1@
...

:SubStrings
0A9F: 1@ = current_thread_pointer
1@ += 0x10
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ -= @SubMsgWelcome
1@ += 4
return

:SubMsgWelcome
0900: "Welcome to blablabla..."
jump @SubMsgEnd

:SubMsgUsage
0900: "Press ~h~~k~~PED_ANSWER_PHONE~~w~ + ~h~~k~~PED_FIREWEAPON~~w~ to blablabla..."

:SubMsgEnd
0000: NOP

Well, the code works correctly, but the problem is that the text is displayed in game all in UPPERCASE mode and I not want this. Is there a way to solve this problem???

Thanks!

Offline

#2 28-06-2008 00:03

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Custom Texts

Go to Sanny's Options-Format-Case converting and set this option to 'As Is'. SB won't convert the strings to uppercase anymore.

Offline

#3 28-06-2008 03:55

Rapier
Registered: 28-04-2008
Posts: 29

Re: Custom Texts

OK, Thanks. I have another problem now! sad. Is the same code but optimized.

{$CLEO}

thread 'TEST'
wait 5000
1@ = 0
gosub @SubStrings //DISPLAY THE 1ST MESSAGE
wait 5000
1@ = 1
gosub @SubStrings //DISPLAY THE 2ND MESSAGE

:LabelControls
...

:SubStrings
0A9F: 2@(1@,2i) = current_thread_pointer
2@(1@,2i) += 0x10
0A8D: 2@(1@,2i) = read_memory 2@(1@,2i) size 4 virtual_protect 0
if
  1@ == 0
jf @SubStrings02
3@ = @SubMsgWelcome
jump @SubStrings03

:SubStrings02
3@ = @SubMsgUsage

:SubStrings03
0062: 2@(1@,2i) -= 3@
2@(1@,2i) += 4
0AA5: call 0x588BE0 num_params 4 pop 4 0 0 0 2@(1@,2i)
return

:SubMsgWelcome
0900: "Welcome to blablabla..."
jump @SubMsgEnd

:SubMsgUsage
0900: "Press ~h~~k~~PED_ANSWER_PHONE~~w~ + ~h~~k~~PED_FIREWEAPON~~w~ to blablabla..."

:SubMsgEnd
0000: NOP

I created an array to facilitate the use of the messages. The first msg is diplayed correctly, but in the second msg the game crashes! Is the array index that is wrong or what?

Offline

#4 28-06-2008 04:27

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Custom Texts

Try this:

{$CLEO}

thread 'TEST'
wait 5000
0AB1: call_scm_func @SubStrings 1 @String1 //DISPLAY THE 1ST MESSAGE
wait 5000
0AB1: call_scm_func @SubStrings 1 @String2 //DISPLAY THE 2ND MESSAGE
wait 5000
0AB1: call_scm_func @SubStrings 1 @String3 //DISPLAY THE 3RD MESSAGE

0A93: end_custom_thread


:SubStrings // do not edit this routine, only strings below
0A9F: 1@ = current_thread_pointer
1@ += 0x10
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ -= 0@ // 0@ is the label @StringN
1@ += 4
0AA5: call 0x588BE0 num_params 4 pop 4 0 0 0 1@
0AB2: ret 0

:String1
0900: "Welcome to blablabla..."
:String2
0900: "Press ~h~~k~~PED_ANSWER_PHONE~~w~ + ~h~~k~~PED_FIREWEAPON~~w~ to blablabla..."
:String3
0900: "Another blahblahblah"


0000: null_termitator

Offline

#5 28-06-2008 20:24

Rapier
Registered: 28-04-2008
Posts: 29

Re: Custom Texts

THANKS A LOT MAN!!! Only one more question: Can I add as many messages I want with this method?

Last edited by Rapier (28-06-2008 20:28)

Offline

#6 29-06-2008 00:11

Seemann
Registered: 07-08-2006
Posts: 2,156

Re: Custom Texts

Yes, as many as you want

:String3
0900: "Another blahblahblah"
:String4
0900: "Another blahblahblah"
:String5
0900: "Another blahblahblah"
...

Offline

#7 29-06-2008 06:04

Rapier
Registered: 28-04-2008
Posts: 29

Re: Custom Texts

OK, thanks again!

Offline

Board footer

Powered by FluxBB