Jump to content

Tasho

Banned
  • Posts

    358
  • Joined

  • Last visited

  • Days Won

    11
  • Feedback

    0%

Posts posted by Tasho

  1. 13 hours ago, tierrilopes said:

    « Players are not able to select NPCs, Metin Stones and players as target! »

    Why not metins? Non-sense.

    Jvgsfab.png

    That's the way of official, everyone can extend it as they want, for players, stones, npc etc.

    Just extend check IsEnemy() IsStone() in line 39 from PythonCharacterManager.cpp (Github), there are more checks if you want:

    • pkInstTarget->IsPC()
    • pkInstTarget->IsStone()
    • pkInstTarget->IsEnemy()
    • pkInstTarget->IsNPC()
    • pkInstTarget->IsPoly()
    • Metin2 Dev 1
    • Love 1
  2.  

    • no data types

    In every language exist data types, but in Python the declaration happens automatically when you assign a value to a variable not need to specify which type to be like int, float, string etc..and you can do assignation with another data type just with operator '=', without killing language like C++ assignation between std::vector & std::map, here is more easy.

    • no semicolons

    The semicolon here does not do anything, but exist and can be used with no problems, does let you use to denote the end of a statement if you are including more than one statement on a line.

    • import command does not distinguish python includes and my includes (like C do by "" and <>)

    #include and import are quite different, C/C++ is a compiled language, C++ you do #include <library> and in Python you have this syntax for import the content of another program file in your own. (i can't explain it very good the difference because have no-sense)

    • Spoiler

      a5x8gab.png

      Two or more physical lines may be joined into logical lines using backslash characters (\)backslash .

      JesusHere =\
      {
      	[....]
      }

    As i said don't try to search difference between 2 languages which both are amazing in them way, Python was choosed by YMIR for write the GUI Engine because is a easy language and flexible instead of C++ or any variants, if you are good at C/C++, you can easily learn Python in some weeks because that is more easy than it..

    Some difference between them are:

    • Python uses Garbage Collection whereas C++ does not.
    • C++ is a statically typed language, while Python is a dynamically typed language.
    • Python is easier to use than C++.
    • Python is run through an interpreter, whilst C++ is pre-compiled.
    • Hence, C++ is faster than Python.
    • C++ supports pointers and incredible memory management.
    • Python supports very fast development and rapid, continuous language development.
    • Python has less backwards compatibility.
    • Majority of all applications are built from C++.
    • Majority of all 3D applications offer Python access to their API's.
    • Python code tends to be 5 to 10 times shorter than that written in C++.
    • In Python, there is no need to declare types explicitly.
    • Smaller code size in Python leads to leads to "rapid prototyping", which offers speed of development.
    • Python requires an engine to run.
    • Python is interpreted each time it runs.
    • Python is hard to install on a Windows box and thus makes distribution of the program problematic.
    • C++ is a pure binary that links to existing libraries to assist the coding.
    • In Python, variables are in scope even outside the loops in which they are first instantiated.
    • In Python, a function may accept an argument of any type, and return a value of any type, without any kind of declaration beforehand.
    • Python provides flexibility in calling functions and returning values.
    • Python looks cleaner, is object oriented, and still maintains a little strictness about types.

    @difference-between-cplusplus-and-python

    • Love 1
  3. That's why metin2 is cancerous community..we stole code/ideas from another guys and put inside without any mention or thanks for it, doesn't importantly if you post free or not.

    1.

    Spoiler
    
    void CTournamentPvP::Destroy()
    {
    	ClearSTDMap();
    	if (running_event != NULL)
    	{
    		event_cancel(&running_event);
    		running_event = NULL;
    	}
    }
    
    void DestroyAutoNotice()
    {
    	message_data.clear();
    	if (running_event != NULL)
    	{
    		event_cancel(&running_event);
    		running_event = NULL;
    	}
    }

     

    2.

    Spoiler
    
    bool CTournamentPvP::Initialize()
    {
    	if (running_event != NULL)
    	{
    		event_cancel(&running_event);
    		running_event = NULL;
    	}
    
    	TournamentPvPInfoData* info = AllocEventInfo<TournamentPvPInfoData>();
    	info->pTournament = this;
    	running_event = event_create(tournament_timer, info, PASSES_PER_SEC(30));
    }
    
    void InitAutoNotice()
    {
    	if (running_event != NULL)
    	{
    		event_cancel(&running_event);
    		running_event = NULL;
    	}
    
    	AutoNoticeInfoData* info = AllocEventInfo<AutoNoticeInfoData>();
    	running_event = event_create(automatic_event_timer, info, PASSES_PER_SEC(1));
    }

     

    3.

    Spoiler
    
    void CheckAutoNotice()
    {
    	time_t cur_Time = time(NULL);
    	struct tm vKey = *localtime(&cur_Time);
    }
    
    void CTournamentPvP::PrepareAnnouncement()
    {
    	time_t cur_Time = time(NULL);
    	struct tm vKey = *localtime(&cur_Time);
    }

     

    There are more..

    You know very well about what i'm talking, already there exist more guys which take system a, b from C and make some changes and adapt it for another things.
    I don't will talk about the rest of code which is already non-sense, already all people can see it. 
    Look:

    Already you and this guy stole the same concept of call event and check real time from Tournament PvP and do some changes, great coders.

    Good luck "Developer of future."

    • Love 3
  4. Already YMIR did that just for codePage (locale.cfg) as 949 < locale/ymir.

    • ../root/uiMiniMap.py
       
    # Search for:
    	def SetMapName(self, mapName):
    		if 949==app.GetDefaultCodePage():
    			try:
    				self.board.SetTitleName(localeInfo.MINIMAP_ZONE_NAME_DICT[mapName])
    			except:
    				pass
    # Replace with:
    	def SetMapName(self, mapName):
    		self.board.SetTitleName(localeInfo.MINIMAP_ZONE_NAME_DICT.get(mapName, uiScriptLocale.ZONE_MAP))

    If you want to add more maps there exist a dictionary MINIMAP_ZONE_NAME_DICT on localeInfo,the key should be name of map (atlasInfo.txt) and value is your map name.

    MINIMAP_ZONE_NAME_DICT = \
    {
    	"metin2_map_n_flame_dragon"  : MAP_FLAME_DUNGEON, # ..locale/en/locale_game.txt
    }
    • Good 1
    • Love 2
  5. 6 hours ago, Braxy said:

    Whatever, shit code :P

    Spoiler
    
    
    
    quest skill_reset begin
    	state start begin
    		when 71002.use begin
    			if pc.get_level() < 30 or pc.get_level() > 120 then
    				say_title(item_name(71002))
    				say("")
    				say("This item can be used in between level 30 and 120.")
    				return
    			end
    			
    			if pc.get_skill_group() == 0 then
    				say_title(item_name(71002))
    				say("")
    				say("You have no skill group.")
    				return
    			end
    			
    			say_title(item_name(71002))
    			say("")
    			say("This scroll will instantly reset")
    			say("your skill group, every skill you have")
    			say("mastered will be losed in the process.")
    			say("")
    			say_reward("Notice: You won't lose any character points.")
    			say("")
    			say("Do you really want to do this?")
    			if (select("Yes", "No") == 1) then
    			
    			pc.clear_skill()
    			pc.set_skill_group(0)
    			horse.set_level(horse_level)
    			char_log(0, "RESET_SKILL", "RESET_SKILL_BY_71002")
    			pc.remove_item(71002);
    			set_quest_state("skill_group","run")
    		end
    	end
    end
    
    

     

     

    I'm not a quester but these are really basic shits which you have to know before write something, you have 'quests which you sell' on that forum, that's very bad.

    • You called x3 times say_title(item_name).
    • You use say("") for make a new row empty, already exist '[ENTER]'.
    • You use item vnum 71002, instead of use item.get_vnum().
    • For questions like Yes, No already exist 'locale.yes, locale.no'.
    • Why you guys start to put ";" at the end of function or returns? Did you know for what is that or just put it and want to look different than another ones?

    'Semi-colons in Lua are generally only required when writing multiple statements on a line, stop use it if don't know how is working, you should learn a bit from Lua documentation before write any code and stop do things which others do.

    Have fun.

  6. @GostMan 

    • Stop using fake account.
    • You are the most of *dum.... from here, because you didn't really understand the sarcasm which @tierrilopes created it, a guy say on first page: "i can write better the code of official and things which containing a lot a lines I can do on one line.", but he doesn't have idea about coding. And from here start some examples from us and make fun about situation, what's your problem? Oh let me know..you are frustrated because you don't understand how it's working the code from us examples? 
    • Don't try to look smart than us because you aren't, don't come with examples of another language if there's all about Python. That one line here is called as "comprehension python list". For simple conditions is ok to use it, but on that case from the previous replies for multiple function to be called doesn't look very good and should stay on normally style.
    • I'm not sure but you are looking like a romanian which didn't eat nothing since a lot a time.
    • You should stop do spam without sense after some weeks just because you are frustrated, if all people do that which all what they don't like it and hate it what happens with community? If I hate something from guys which talking on some topics should I check now all topics and go and say them "yo guys, you are *dum...? Was ok if you was registered when we was had that discussion, not after some weeks.

    Have fun.

    • Love 2
  7. 32 minutes ago, WeedHex said:

            function right_item()
                local value_x = item.get_vnum()
                if value_x >= 85001 and value_x <= 85024 then
                    return true
                else
                    return false
                end
            end

     

    if questname.right_item() == true then

    Stop to kill Lua please.

    function right_item()
    	return item.get_vnum() >= 85001 and item.get_vnum() <= 85024
    end

    And don't reply if you don't understand what exactly he want.

    3 hours ago, TheMadNurse said:

    that makes as short as possible the when-begin clause, because I need to include a lot of item values for the item.get_vnum() function. The function has to return a group of items divided into various arrays (e.g.: local name_item_group_1 = {vnum_item_1, 2 , 3, etc...}) for the various sub types of items (e.g.: swords, daggers, bows, etc...). The result has to look like that:

    function CanTakeItem(itemVnum)
    	local table_items = { 14500, 12000, 18000 }
    
    	for _, v in pairs(table_items) do
    		if v == itemVnum then
    			return true
    		end
    	end
        return false
    end
    
    -- when npc_id.take with questName.CanTakeItem(item.get_vnum()) begin

     

    • Love 1
  8. On 2/16/2018 at 8:12 PM, WLsj24 said:

    But how can I instantiate uipetsystem.py to uitooltip.py? I do not know much about python :(

    
    def SetSkill(self, slot, idx, lv):
    		if int(idx) != -1:
    			[...................]

    How can I make the file uitooltip.py read that which is in uipetsystem.py

    I don't know nothing about how it's working that pet, but i think you can do something like that on python, not sure.

    • uiPetSystem.py
    import uiToolTip
    [..............]
    ###################################
    g_PetSkillSlotAvailableDict = {}
    def GetPetSkillSlot():
    	return len([slot for slot in g_PetSkillSlotAvailableDict.values() if slot])
    
    ###################################
    def SetSkill(self, slot, idx, lv):
    	if int(idx) != -1:
    		[..............]
    
    	g_PetSkillSlotAvailableDict.update({int(slot) : int(idx) != -1})
    ###################################
    • uiToolTip.py
    from uiPetSystem import GetPetSkillSlot
    self.AppendTextLine('(%d)' % GetPetSkillSlot(), self.NORMAL_COLOR)
    • game.py
    	self.__BuildDebugInfo()
    	###############################
    	import uiPetSystem
    	uiPetSystem.g_PetSkillSlotAvailableDict.clear()

    That's a shit thing to do it on python, because you can't see the length of it until you didn't call SetSkill << and for that i think you have to use item, so for tooltip will be bad.

  9. Quote

    'tuple' object has no attribute 'has_key'

    The method  has_key() returns true if a given key is available in the dictionary, otherwise it returns a false.

    You have tuple not a dictionary, so you should do something like:

    if number in tupleArgs:
      [....]

    Or maybe your code is expecting a dictionary and getting a tuple instead.

    Upload the file on

    This is the hidden content, please
    , i can't download them from attachments.

    • Metin2 Dev 2
    • Sad 1
    • Good 5
    • Love 2
  10. .

    • UPDATE = The UPDATE statement is used to modify the existing records in a table.
    • INSERT = The INSERT INTO statement is used to insert new records in a table.
    50 minutes ago, amosth said:
    • mysql_direct_query(string.format("UPDATE player.kill_system SET quantidade = %d WHERE id = %d;", pc.getqf("total_players"),

     

    • You trying to update field id <which doesn't exist>
    • First one you need to do INSERT and after that UPDATE, there are many solutions for that, but i would like that one: INSERT ... ON DUPLICATE KEY UPDATE
    local quantidade = pc.getqf("total_players")
    mysql_direct_query(string.format("INSERT INTO player.kill_system (id, quantidade) VALUES(%d, %d) ON DUPLICATE KEY UPDATE quantidade = quantidade + %d;", pc.get_player_id(), quantidade, quantidade));

    If you specify an ON DUPLICATE KEY UPDATE clause and a row to be inserted would cause a duplicate value in a UNIQUE index or PRIMARY KEY, an UPDATE of the old row occurs.

    • Love 1
  11. 32 minutes ago, Mali61 said:
    
    	def GetChName(self, p):
    		import constInfo
    		text = constInfo.loadingname
    		uzunluk = len(text)
    		asd = uzunluk*p/100
    		return text[0:asd]

     

    # import constInfo - at the beginning of the file
    def GetChName(percentage):
    	name = constInfo.loadingname
    	return name[:(len(name) * percentage) / 100]

    And please stop to use turkish name for variables when you share something, looks very creepy..

    • Love 1
  12. 9 minutes ago, Syreldar said:

    It's printing 60 times instead of 30 because you are asking it to print it twice lol

    Ok then, maybe i'm noob.

    Put the final code (for metin2, not print function) to SetEvent on the both list (self.SelectBtnNameList, self.SelectBtnFaceList) with good arguments, like that. 

    Spoiler

    keLpeab.jpg

    I think you don't understand how exactly need to work, please read again every row from my output.

  13. 10 minutes ago, Syreldar said:

    Don't know what are you talking about, really, his method works perfectly and it's easy as fuck to comprehend.

    Add the self.SelectBtnFaceList on print too,, and run it, you will get a loop of x60 times (repeat x2 same thing), when need just x30 times. -

    Run it: http://tpcg.io/C4Vv2s

    Do you think that's a good loop? what's about that eventList items? Read with careful how should be output on my image.

    • Metin2 Dev 1
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.