Parameters in custom messages
Moderator: Graphics Moderators
-
- Engineer
- Posts: 111
- Joined: 08 Feb 2007 11:59
- Skype: a.locritani
- Location: Italy
Parameters in custom messages
Hi!
I've a simple question: can I put a parameter value in a custom message? example: parameter #1 = 1 -> text in custom message: "the first parameter is 1" in a dynamic way (so if param is 2 the same text shows 2 and so on) not using static messages and a series of "if" (action7)
I know that using action4 I can set custom messages, and string codes 7B..87 can format the text so it's shown on wanted format. but how putting parameters there?
and another question: string codes 7B..87 take their argument from the stack, but what this means? i know what a stack is: a LIFO (last-in/first-out) structure. well, string codes 7B...87 and others do a "pop" from the stack (I think), but who does "push" and when?
I've looked in the wiki and i found nothing. It's not there or I've missed it?
thanks in advance
I've a simple question: can I put a parameter value in a custom message? example: parameter #1 = 1 -> text in custom message: "the first parameter is 1" in a dynamic way (so if param is 2 the same text shows 2 and so on) not using static messages and a series of "if" (action7)
I know that using action4 I can set custom messages, and string codes 7B..87 can format the text so it's shown on wanted format. but how putting parameters there?
and another question: string codes 7B..87 take their argument from the stack, but what this means? i know what a stack is: a LIFO (last-in/first-out) structure. well, string codes 7B...87 and others do a "pop" from the stack (I think), but who does "push" and when?
I've looked in the wiki and i found nothing. It's not there or I've missed it?
thanks in advance
Re: Parameters in custom messages
Please specify where you want to use that "custom message".
a) ActionB
b) Vehicle/Station/Industry Name
c) Message returned by some callback (e.g. additional text in various build/show vehicle/industry windows)
d) something else?
a) ActionB
b) Vehicle/Station/Industry Name
c) Message returned by some callback (e.g. additional text in various build/show vehicle/industry windows)
d) something else?
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
-
- Engineer
- Posts: 111
- Joined: 08 Feb 2007 11:59
- Skype: a.locritani
- Location: Italy
Re: Parameters in custom messages
I want to use it as a message returned from callback 28
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Re: Parameters in custom messages
As the range 0000-03ff displays the misc .grf text Dxxx as error message, you should be able to use substrings in constructing those .grf texts, i.e. 81 Print substring (text ID in next 2 bytes of string).
regards
Michael
regards
Michael
-
- Engineer
- Posts: 111
- Joined: 08 Feb 2007 11:59
- Skype: a.locritani
- Location: Italy
Re: Parameters in custom messages
@michael blunk
ok, i know i can use substring but I can use parameters as substring? I think not. or at least I cannot find a text id that refers to parameter.
ok, i know i can use substring but I can use parameters as substring? I think not. or at least I cannot find a text id that refers to parameter.
Re: Parameters in custom messages
One of the 9A codes will push a word onto the stack. "\9A\##\00\00", preceeded by an action 6 that changes the \00\00 to the content of the appropriate parameter, will allow you to use any of the print-word codes to display the content of that GRF parameter. You could also use two print-byte codes, if the parameter was two packed bytes. Using the push-word code twice (high word first, I think) will, with some action 6 magicking, allow you to display a doubleword.
It's probably best to put this string in some out-of-the-way place (eg D3FF) , and reference it with \81, so you don't have to mess with the action 6 when you translate the string.
It's probably best to put this string in some out-of-the-way place (eg D3FF) , and reference it with \81, so you don't have to mess with the action 6 when you translate the string.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
-
- Engineer
- Posts: 111
- Joined: 08 Feb 2007 11:59
- Skype: a.locritani
- Location: Italy
Re: Parameters in custom messages
Thanks, DaleStan, I'll try your suggestion.
Who is online
Users browsing this forum: belgi and 7 guests