ProfessorEnte
-
Posts
42 -
Joined
-
Last visited
-
Days Won
3 -
Feedback
0%
Content Type
Forums
Store
Third Party - Providers Directory
Feature Plan
Release Notes
Docs
Events
Posts posted by ProfessorEnte
-
-
Hey,
the idea to implement Snake in Metin2 came from MrSIBI think it's a cool idea and that's why I implemented it.
Preview
Spoiler
Control
w,a,s,d to control the snake
spacebar = pause
SettingsYou can set in the script if you are allowed to go through the wall or not and change the size of the drawn boxes or the playing field.
Execute:e.g. in the game.py above to the imports:
"import snakeGame"
After logging into the game you will see the window.
Settings
SpoilerDEBUG = False ## Enable debug BOX_SIZE = 10 ## You can change the size of the drawn boxes as you like. I found 10 quite good. ## width and height are your playfield sizes. I found 200 quite good. But if you set the BOX_SIZE to 1 it is too big. GAME_BOARD_WIDTH = 200 GAME_BOARD_HEIGHT = 200 ## keyboard bindings KEY_RIGHT = app.DIK_D KEY_LEFT = app.DIK_A KEY_UP = app.DIK_W KEY_DOWN = app.DIK_S KEY_PAUSE = app.DIK_SPACE INCREASE_SPEED_AFTER_EAT_COUNT = 3 ## after the snake reaches the length 3, 6, 9, ... the speed is increased. SNAKE_START_COORDS = [[2,1],[1,1],[0,1]] ## head, tail, tail => Ooooo SNAKE_START_DIRECTION = KEY_RIGHT ## the starting direction of the snake START_SPEED = 1.2 ## 1.2 = slow (paint snake every 1.2s) MAX_SPEED = 0.5 ## 0 = fast BORDER_DEAD = True ## if the border is hit then dead (true) or pass through (false) ## https://doc.instantreality.org/tools/color_calculator/ SNAKE_COLOR = grp.GenerateColor(0.027, 0.490, 0.078, 1.0) SNAKE_HEAD_COLOR = grp.GenerateColor(0.176, 0.725, 0.235, 1.0) SNAKE_DEAD_COLOR = grp.GenerateColor(0.9, 0, 0, 1.0) FOOD_COLOR = grp.GenerateColor(0.9, 0.5, 0, 1.0) BORDER_COLOR = grp.GenerateColor(1, 1, 1, 1.0)
Have fun!
Download:
- 9
- 1
- 3
- 6
- 2
- 11
-
Hey,
due to recent events, I wanted to publish a bug, which was available in my itemshop a few years ago.
In many pub systems written with Lua, it is still present and some people like to take advantage of it.
If we continue the example with the itemshop, it was possible to "buy" items for free.For example, instead of a number, the client sends the value "NaN" (Not a Number) for the number of items to be bought.
In the quest tonumber() is now executed and "NaN" remains "NaN".
cmd = "NaN" --(sends "NaN" instead of a number) amount = tonumber(cmd) -- now contains NaN
If a comparison now is made, the result is always false:
if amount > 200 then print'The maximum amount is 200.' return end -- FALSE if amount < 1 then print'The minimum amount is 1.' return end -- FALSE
That is not such a big problem at first.But if you do a calculation and then compare if the coins are enough, then we have a problem:
cmd = "NaN" --(sends "NaN" instead of a number) amount = tonumber(cmd) -- now contains NaN mycoins = 0 -- The number of coins from the Coins column of the account table itemPrice = 1000 -- Price of the item in the item store realPrice = itemPrice*amount -- 1000 * NaN => NaN if mycoins < realPrice then print 'Unfortunately you do not have enough coins.' return end -- FALSE (0 < NaN) -- Not enough Coins, but it goes on, because the comparison was false. -- Give item. -- Item was bought with 0 Coins.
Here is a link to it:
http://lua-users.org/wiki/InfAndNanComparisons
A script for testing (https://repl.it/ under Lua):
-- cmd is the value sent by the client as example a number of items you want to buy. If you now calculate with this value and send instead of a number NaN, inf, -inf, ... cmd = "200" --cmd = "NaN" -- remove comment for testing (sends "NaN" instead of a number) amount = tonumber(cmd) -- mycoins is the number of coins, which are in the Coins column of the account table mycoins = 1000 -- mycoins = 0 -- remove comment for testing (sets existing coins to 0) itemPrice = 100 if amount > 200 then print 'The maximum amount is 200.' return end if amount < 1 then print 'The minimum amount is 1.' return end realPrice = itemPrice*amount if mycoins < realPrice then print 'Unfortunately you do not have enough coins.' return end newCoins = mycoins-realPrice print('set new coins in db '..newCoins) print 'give item
How it can be fixed, for example:
function IsFinite(num) return not (num ~= num or tostring(num) == "inf" or tostring(num) == "-inf" ) end -- Example call amount = tonumber("123") if not IsFinite(amount) then return end -- Everything ok amount = tonumber("NaN") if not IsFinite(amount) then return end -- triggers return
- 1
- 4
-
On 5/17/2020 at 5:33 AM, shaman21 said:
Hello, how are you? do you disagree? please let me know.
Thanks for asking. I'm fine.
Maybe u forgot the real question?
- 3
-
#Update (very easy to use):
"Board" Animation Class (enlarge and shrink)
PreviewVideo
https://metin2.download/picture/2U7koEpVJDF8XLGAwz85oA3G6MfQC23h/.gif
Call it:
Add to imports at the top of game.py:
"import example_boardAnimation"After the login in the game you will see the window
Download:- 33
- 1
- 8
- 1
- 27
-
#Small changes
When holding CTRL (can be changed) the cursor changes and text can be translated instantly.
In addition, already translated texts are now stored for faster translation.
Spoiler- 2
-
7 hours ago, Mali61 said:
Is there a better alternative with api?
Sure. Deepl. But I have not found any way to use it without paying 0.01€ per 500 character.
-
20 minutes ago, Tunio said:
There is already an identical system on the server rop2.global ...
Yes this is my system. xD
It's the first Version. I am currently updating the translator with some new functions.
-
Hey,
I am currently working on an ingame translator (Python & c++) for Metin2.
It uses the Google Translator.
You only have to press the "Translate Button" at the bottom of the taskbar (the cursor changes then) and any text can be translated directly.
If you want to select more text at once, then you have to hold shift.
If the "Instant Translate" checkbox is activated, the text will be translated on sending (for chat and whisper).
A preview of the current state:https://metin2.download/video/5if9WiAT80epQDleLVyeH9aoSi5QZOe4/.mp4
Do you find the whole thing useful at all and would you want to use it?Do you have any ideas?
- 2
- 11
-
8 hours ago, hachiwari said:
Sexy, i hope that code is also sexy ;3
The code has been kept simple so that it can be easily understood. You can always optimize everything.
21 hours ago, North said:Great job, this is a very handy reference. Could you use github gists/repo instead of mega downloads? Thanks
Yeah, I've been thinking about that, too, because things are getting messy. As soon as I find the time.
-
Introduction
Hey,
since I'm often asked if I can make an example for this or that in Python, I just post some of these examples in this thread from time to time.
Usually they just end up in my trash (that's why the collection is small for now) but maybe it will help some of you to learn something.
You are also welcome to post examples here and I will add them to the startpost.
You have a wish for a certain example?Then write it in here.
PS:These examples are designed very simple, so that they can be understood.
Examples
ui.ComoBox()
Spoilerui.ScrollBar() with text
Spoilerui.AniImageBox() as loading bar
SpoilerPreview:
Call it:
Add to imports at the top of game.py:
"import example_loadingbar"and simply move the file "loading_bar.tga" into the client folder. (There where the .exe is located).
Otherwise change the path in the python file "example_loadingbar.py".
After the login in the game you will see the window.
Download:ui.ListBox()
Spoilerui.ToggleButton()
Spoilerui.RadioButtonGroup()
Spoilerui.DragButton()
Spoilerui.Bar(), ui.Box(), ui.Line()
Spoilerui.Gauge(), ui.SliderBar()
Spoilerui.TextLine(), ui.EditLine()
SpoilerPagination
SpoilerTabs
SpoilerDropDown Tree
SpoilerPreview:
Call it:
Add to imports at the top of game.py:
"import example_dropdownTree"and simply move the folder "exampleDropdownTree" into the client folder. (where the .exe is located).
Otherwise change the path in the python file "example_dropdownTree.py".
After the login in the game you will see the window.
Download:Category Navigation
SpoilerListBox Search
SpoilerTextLineScrollable Class
SpoilerCollapsible window
SpoilerPreview:
Call it:
Add to imports at the top of game.py:
"import example_collapseWnd"and simply move the folder "exampleCollapseWnd" into the client folder. (where the .exe is located).
Otherwise change the path in the python file "example_collapseWnd.py".
After the login in the game you will see the window.
Download:- 85
- 1
- 2
- 2
- 2
- 26
- 6
- 99
-
The boy who wants to build a botnet, haha.
Do not trust.
- 1
-
vor 4 Minuten schrieb Chyu ^^:
I currently work on implementation of Chromium to a client. I will tell you when I finish or we can try to do it together.
Wow!
Yes, please let me know.
-
Another user told me that aeldra uses the awesomium engine as a browser alternative in their client.
Now the only question is, who can install it or maybe has already installed it. -
hey,
has anyone ever dealt with the ingame browser of Metin2?
It's quite old and doesn't support some newer websites.
I would like to use the paypal payment process. However, the old metin2 browser is no longer supported
What are the possibilities?
Have any of you ever tried upgrading or even adding a completely different one?Mfg Ente.
- 1
-
On 11.9.2015 at 3:32 PM, Dafuq313 said:
Closed mind ? I just said that i don't like it because it's useless ( IT IS ).And no,is not always good to have something else on the server.
This system is purely useless,you can write informations that are not yours ( facebook,skype,email etc ) and then somebody takes them and harras somebody else.Is this "good to have on the server" ... i think you are closed mind since you think so,you look forward ( like you said ) "is good to have something new" but you don't look in other ways "what impact would have this on the server".
Wow, these arguments are shit.
Good idea!
-
-
woa awesome!!!
-
more bugs than "his" quest.
-
U should delete the whole quest because the one u use is buggy
-
-
BUG: Player kills get counted twice.
- 2
-
I just found some old questfunctions from my old lua extensions.
On this way I spawned the ugly fences in the background:
https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif
But you can't set the direction, so look for something roundly
-- Join a dungeon index like: 208001 function d.join_by_index(dungeonIndex,x,y) pc.warp(x*100,y*100,dungeonIndex) end -- Spawn fences: Name, Vnum, Startposition X on map,Startposition Y on map, X Space between the fences, Y Space between the fences, How many fences you want to spawn function d.spawn_object_fence(objectName,objectVnum,objectX,objectXadd,objectY,objectYadd,objectCount) local i = 0 while i < objectCount do d.set_unique(objectName.."_"..i,d.spawn_mob(objectVnum, objectX, objectY)) i = i+1 objectX = objectX + objectXadd objectY = objectY + objectYadd end end -- Delete fences: Name, How many fences of this name you want to delete function d.delete_object_fence(objectName,objectCount) local i = 0 while i < objectCount do d.purge_unique(objectName.."_"..i) i = i+1 end end
- 1
-
By the way, the d.new_jump() function is a lil bit messed up in the game 2089.
You try to join the mapindex 0, because the parameters of the function in the game are in the wrong order.
Here you can find a fix:
http://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/1823057-fix-d-new_jump-single-player-dungeons.html
Ente's Python Examples
in Features & Metin2 Systems
Posted · Edited by Metin2 Dev
Core X - External 2 Internal
#Update:
Money Animation Class
Preview
Call it:
Add to imports at the top of game.py:
"import example_moneyAnimation"
After the login in the game you will see the window
Download:
Type Writer Scrollable Textline Class
Preview
Call it:
Add to imports at the top of game.py:
"import example_typeWriterAnimation"
After the login in the game you will see the window
Download:
ListBoxDrag Class
Preview
Call it:
Add to imports at the top of game.py:
"import example_listBoxDrag"
After the login in the game you will see the window
Download: