AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HTML] Lang File + HTML - Something Wrong? (https://forums.alliedmods.net/showthread.php?t=237924)

Baws 03-31-2014 21:40

[HTML] Lang File + HTML - Something Wrong?
 
Every time i try to like test, there's some unknown symbols in the MOTD with a white screen.
Something wrong with this?

Here is the code: ( It's the lang file )

Code:

[en]
SH_MENU_TITLE = Surf Help Menu:
SH_MENU_LEARN_TEXT = Learn by: \rText
SH_MENU_LEARN_VIDEO = Learn by: \rVideo
SH_MENU_STOP_VIDEO = \r[\yStop The Video\r]

SH_CASE_EXIT = !g* !nYaaaayyy! !t%s!n, you are now a good surfer. Ask questions to be even better. Good Luck! !g*

SH_CASE_ZERO_LEARN_TEXT :
<html>
        <head>
                <style type="^&quot;text/css^&quot;">
<!--{cke_protected}{C}%3C!%2D%2D.sty1%20%7Bcolor%3A%20%23cdcccb%3Bfont-family%3A%20Arial%2C%20Helvetica%2C%20sans-serif%3B%7D%2D%2D%3E-->                </style>
        </head>
        <body bgcolor="^&quot;#000000^&quot;">
                <div align="^&quot;center^&quot;">
                        <span class="^&quot;sty1^&quot;"><strong>- Surf Help -</strong></span></div>
                <p>
                        &nbsp;</p>
                <table border="^&quot;1^&quot;" width="^&quot;100%%^&quot;">
                </table>
                <table border="^&quot;1^&quot;" width="^&quot;100%%^&quot;">
                        <tbody>
                                <tr>
                                        <td>
                                                <span class="^&quot;sty1^&quot;">To surf, jump or walk onto one of the curved walls (hereby referted to as 'ramps'). Then simply hold strafe (Default are the A and D keys). This will cause you to glide along the walls, or &quot;surf&quot;.</span></td>
                                </tr>
                                <tr>
                                        <td>
                                                <span class="^&quot;sty1^&quot;">While surfing, never press up, down, or crouch; pressing those will cause you to slide off the wall and fall, which, in most surf maps, will cause you to get sent back to your spawn.</span></td>
                                </tr>
                                <tr>
                                        <td>
                                                <span class="^&quot;sty1^&quot;">To change direction (in order to make it to the next ramp), press the button for the direction you wish to go before flying off of your current ramp.</span></td>
                                </tr>
                                <tr>
                                        <td>
                                                <span class="^&quot;sty1^&quot;">Surfing takes pratice, so don't be discouraged if you don't get it right the first time.</span></td>
                                </tr>
                        </tbody>
                </table>
                <p align="^&quot;center^&quot;">
                        <span class="^&quot;sty1^&quot;"><strong>* For more help, check out the video by closing this screen and clicking #2! *</strong></span></p>
        </body>
</html>
:

SH_CASE_ONE_LEARN_VIDEO :
<html>
        <head>
                <title></title>
                <style type="^&quot;text/css^&quot;">
body{background:#000000;margin-left:8px;margin-top:0px;}                </style>
        </head>
        <body>
                <p brought="" by="" h3="" is="" n="" span="" style="^&quot;text-align:" this="" to="" video="" you="">
                        <span style="^&quot;color:d7d5d2;^&quot;"><strong>Advanced Surfing Help Video</strong></span>^n</p>
                <p depends="" internet="" loading="" n="" note:="" on="" p="" span="" style="^&quot;text-align:" time="" your="">
                        <span style="^&quot;color:cdcccb;^&quot;">Make sure to follow these steps, or you will end up in jail!</span></p>
                <p>
                        ^n</p>
                <pre>
                </pre>
                <center>
                        <pre>
                        <object data="^&quot;http://allied-gamers.com/player.swf^&quot;" height="^&quot;350^&quot;" quality="^&quot;high^&quot;" type="^&quot;application/x-shockwave-flash^&quot;" width="^&quot;400^&quot;">^n
<param name="^&quot;movie^&quot;" value="^&quot;http://allied-gamers.com/player.swf^&quot;" />^n
<param name="^&quot;FlashVars^&quot;" value="^&quot;backcolor=0x000000&amp;frontcolor=0xCCCCCC&amp;lightcolor=0x996600&amp;autostart=true&amp;volume=50&amp;file=http://www.youtube.com/watch?v=opdR6MVNIE4^&quot;" />^n
</object></pre>
                </center>
        </body>
</html>
:

SH_CASE_TWO_STOP_VIDEO :
<html>
        <head>
                <title></title>
                <style type="^&quot;text/css^&quot;">
pre{color:#cdcccb;}body{background:#000000;margin-left:8px;margin-top:0px;}                </style>
        </head>
        <body>
                <pre>
                </pre>
                <center>
                        <pre>
                        <b>Video Stopped.</b>
This has been brought you by Baws.
%s plugin is here to help you out.
Hope you learned something from this!</pre>
                </center>
        </body>
</html>
:


fysiks 03-31-2014 23:16

Re: [HTML] Lang File + HTML - Something Wrong?
 
Doesn't look like a lang file to me, it doesn't follow the correct format afaik.

Also, you shouldn't put HTML in a lang file (HTML structure is only interpreted in one language).

Black Rose 04-01-2014 06:44

Re: [HTML] Lang File + HTML - Something Wrong?
 
Put all the HTML in a file. Leave %L placeholders where the translated text should be. Read the text file and use that as the format[] arg of formatex(). Add all ML arguments afterwards.

Baws 04-01-2014 16:52

Re: [HTML] Lang File + HTML - Something Wrong?
 
But i saw Biohazzard mod and it did the same thing as me. Why mine didn't work?

Neeeeeeeeeel.- 04-01-2014 17:06

Re: [HTML] Lang File + HTML - Something Wrong?
 
Quote:

Originally Posted by baws (Post 2118947)
But i saw Biohazzard mod and it did the same thing as me. Why mine didn't work?

Because you aren't following the right format. Btw, you should only use lang format for text, not whole html code.

Black Rose 04-01-2014 17:36

Re: [HTML] Lang File + HTML - Something Wrong?
 
You are not escaping all the % correctly.
Code:

<!--{cke_protected}{C}%3C!%2D%2D.sty1%20%7Bcolor%3A%20%23cdcccb%3Bfont-family%3A%20Arial%2C%20Helvetica%2C%20sans-serif%3B%7D%2D%2D%3E-->                </style>
%20sans-serif will be read as an input. Numerical values between the selection of the data type will be read as limits. For example %.20s will force the input to be cut off after 20 characters. Exactly like %.2f that will only use 2 decimals for floats.
Example:
Code:
server_print("%.2s", "1234");
Code:

12


Code:

"^&quot;
That makes no sense at all. Especially when it's used on parameters:
Code:

<body bgcolor="^&quot;#000000^&quot;">
This would be fine as long as the text is defined outside of the pawn script.
Code:

<body bgcolor="#000000">
It's only the compiler that is reading " and defining them as termination of strings. If reading from any other source, like a file or a variable the runtime functions will only see this as 100010 / 0x22 / 34.

What happens when you save a string in pawn containing ^" is that the compiler replaces that with one cell only containing ". The ^ is just to tell the compiler to do so.

I would however leave it without quotes since you're almost touching that MOTD limit of 1536 characters, making ML very limited. Save all the space you can.

Baws 04-01-2014 17:54

Re: [HTML] Lang File + HTML - Something Wrong?
 
@Neee....l, you can use whole html code in a lang file, instead of line by line.
Code:
new iTest[ 1052 ]; formatex( iTest, charsmax( iTest ), "%L", id, "LANG_HTML_MOTD" ) show_motd( id, iTest, "Title or Something here" )

Then in the lang file you put the html code.


@Black Rose, Nothing worked, it's not just 1 html code in the lang file. Nothing of those html codes works.
And is there a way to remove those %? Or just put more characters?

Black Rose 04-01-2014 18:49

Re: [HTML] Lang File + HTML - Something Wrong?
 
I tested the first 4 and the first big one. Works just fine.
Escape % with %% because the escape is for a runtime function, not the compiler.

fysiks 04-01-2014 18:49

Re: [HTML] Lang File + HTML - Something Wrong?
 
If you've seen it done in another plugin (the version of Biohazzard that I was able to get did not have any HTML in the lang file). If you have a version that does it, you should post the lang file so we can see how they do it (in fact, if you knew of a source that already did it, you should have used that as your template/example).

If it was going to work, you would probably need to put it all on one line with NO whitespace (i.e. all a single line) and make sure to escape all reserved characters (e.g. %).

Baws 04-01-2014 19:03

Re: [HTML] Lang File + HTML - Something Wrong?
 
I saw this one:
Code:

HELP_MOTD :
<html>
        <head>
                <style type="text/css">
                        pre
                        {
                                font-family:Verdana,Tahoma;
                                color:#FFFFFF;
                        }

                        body
                        {
                                background:#000000;
                                margin-left:8px;
                                margin-top:0px;
                        }
                </style>
        </head>

        <body scroll="no">
                <pre>
                        <img src="http://img182.**************/img182/904/bio3od0.jpg">^n
                        Biohazard v#Version# by cheap_suit^n^n^n
                        Biohazard gameplay is a classic zombie outbreak scenario. Your goal is to^n^n
                        fight off the zombies and avoid getting infected. If you're unlucky and^n^n
                        become infected, your new goal is to infect/kill the remaining survivors.^n^n
                        ^n^n^n
                        Chat Commands:^n^n
                        say /help to open this motd.^n^n
                        say /class to open the class menu.^n^n
                        say /guns to enable the equip menu.^n^n
                </pre>
        </body>
</html>
:

I will try and add another % to the % so it will be like %%.
That's escape right?

Plus, i will remove the
Code:

&quot;
and remove the ^ from them. After that i will see if it will work, if not i will just post here again.


All times are GMT -4. The time now is 05:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.