Jump to content

Recommended Posts

Posted
18 minutes ago, MasterToma said:

Ok, now it works

Fix of the select with one case in master.

 

18 minutes ago, MasterToma said:

1. (4*(talker.param2 % 10))

Modulo precedence fix in master.

 

19 minutes ago, MasterToma said:

2. ((Rand(3)+1)*4)

This only will be problem if multiplication in NASC compiler has the same precedence as addition.

 

18 minutes ago, MasterToma said:

if (a && c || d)

This only will be problem if OR has the same precedence as AND.

Posted (edited)
12 minutes ago, verbrannt said:

This only will be problem if multiplication in NASC compiler has the same precedence as addition.

This only will be problem if OR has the same precedence as AND.

I understand it. But some of cases might like like with modulo.

 

I wouldn't noticed difference in if (a && c || d) if NASC would generated same code.

 

Could you please also add bracers for all nested expressions?

 

According to leaked code, all nested expressions have (). I'm not sure about such thing as precedence in script-engine, I could show you their VM code, where arguments only taken from stack in such and order in which compiler pasted them.

 

And NASC pasted them in opposite order :) (as I wrote in recent post)

Edited by MasterToma
Posted (edited)
12 minutes ago, MasterToma said:

I understand it. But some of cases might like like with modulo.

With modulo was different case. Modulo has same precedence as multiplication and division.

 

12 minutes ago, MasterToma said:

I wouldn't noticed difference in if (a && c || d) if NASC would generated same code.

I've tested it:


        1 && 2 || 3;
        (1 && 2) || 3;

        1 || 2 && 3;
        1 || (2 && 3);
        1 && (2 || 3);

         (1 || 2) && 3;

 

First two lines compiles in absolutely identical stack machine code. Also line 3 == line 4.
 

12 minutes ago, MasterToma said:

According to leaked code, all nested expressions have ()

It's because the decompiler, that was used to produce that leaked code, has no checks of operator precedence. It just adds braces everywhere after each operands pop from stack.

Edited by verbrannt
Posted (edited)

I never used shitty NASC decompilers :D No, Scripts from C0 were leaked. Real one with comments, etc. You should know it.

 

Okay, I will find good example, where OBJ code differs. Or if you don't want to hear about bugs, just say it clearly ;) I'm comparing two obj's with diff, so code differs... And Im trying to find good example, like with modulo

Edited by MasterToma
Posted
6 minutes ago, MasterToma said:

Or if you don't want to hear about bugs, just say it clearly ;)

Idk what you're talking about :) I've fixed every bug from your feedback, even not bugs (like increment/decrement & select with one case).
When you'll find another different obj code of course if will fix that.

Posted (edited)

Okay then... so as I told, nested bracers change resulted ai.obj

 

Try this one (output https://pastebin.com/6Su1S470)

	EventHandler TALK_SELECTED(talker) 
	{
		if ( HaveMemo(talker, @trial_of_scholar)==1 &&    
OwnItemCount(talker, @dieters_diary) >= 1 || OwnItemCount(talker, @scripture_chapter_1) >= 1 || OwnItemCount(talker, @strong_liquor) >= 1) 
		{
			AddChoice(0,"Mention what Raut said");
		}
	}

and with additional bracers

	EventHandler TALK_SELECTED(talker) 
	{
		if ( HaveMemo(talker, @trial_of_scholar)==1 &&    
(OwnItemCount(talker, @dieters_diary) >= 1 || OwnItemCount(talker, @scripture_chapter_1) >= 1 || OwnItemCount(talker, @strong_liquor) >= 1)) 
		{
			AddChoice(0,"Mention what Raut said");
		}
	}

https://pastebin.com/JL3sWgyz (output)

 

Scroll to the end in pastebin, to see the difference

 

The same in complex cases with + and *

 

Take into account, that NASC is actually simple stream translator, so it doesn't have (almost) context like AST. It translates line by line (with special handling of loops and if/else)

Edited by MasterToma
Posted (edited)
17 minutes ago, MasterToma said:

so as I told, nested bracers change resulted ai.obj

 

Yes, of course. I know this.

I've tried compile-decompile-recompile this code

class guard_babenco {
handler:
    EventHandler TALK_SELECTED(talker) {
        if (1 && 2 || 3 || 4) {
            Say("Hello");
        }

        if (1 && (2 || 3 || 4)) {
            Say("Hello");
        }
    }
}

And nothing changed. I've got same obj file as before decompilation.

But if you have any unfixed example of broken nesting of logical operators, provide an obj.

 

Of course if in OBJ we have something like 1 && (2 || 3 || 4) but after decompilation got 1 && 2 || 3 || 4 - it's a bug, and I need example.

But if we have (1 && 2) || 3 || 4 in OBJ and after decompilation got 1 && 2 || 3 || 4 - it's not a bug.

Edited by verbrannt
Posted (edited)
Quote

But if you have any unfixed example of broken nesting of logical operators, provide an obj.

I sent you ai.obj from C1. Being decompiled (bracers are missed) and compiled back, ai.obj with mixed and/or is produced. I pasted in my recent posts.

 

I have about 35 classes with such case. You can check drunkard_treaf for instance

Edited by MasterToma
Posted (edited)
1 hour ago, MasterToma said:

You can check drunkard_treaf for instance

Ok here I see difference. Looks like not logical operators bug, but IF statement bug. Also if c1 ai.obj was compiled with another compiler than you have, this differences can occur. Anyway original OBJ and recompiled OBJ produces same decompiled code.

Do you have leaked (original) source of this class?

 

UPD original code that produces identical to your ai.obj result:
 

(HaveMemo(talker, @trial_of_scholar) == 1 && (OwnItemCount(talker, @dieters_diary) >= 1 && OwnItemCount(talker, @scripture_chapter_1) >= 1 && OwnItemCount(talker, @strong_liquor) >= 1))


So there's useless braces in the original ai.obj.

 

Edited by verbrannt
Posted (edited)

Looks like we lost and talking about different things. I really understand, that if there are only &&, no point in extra bracers... belive me, because I've decompiled most of L2, and it works (including NASC itself). But this info about extra scope () is present in ai.obj. I posted examples, where you can see the difference. I posted the difference in pastebin. NASC generates DIFFERENT code for (a && (b && c)) and for (a && b && c). But decompiler restores them in SAME way - no bracers. I don't know how to be more clear. 

 

I have two concerns about it. First - messed diff. I can't compare original and recompiled objs due to much more trash. Second - there is might be some weird context, which might lead to bug.

 

OK, never-mind, you did great job anyway.

 

I have at least two more bugs apart this:

1. some jump is just missed. Have no idea, but in original class's obj there is just 1 more jump instruction. I can't say nothing concrete, because diff produces too much mismatches due to my previous point. Could you just add those bracers? Or point me the function and I'll fix it by my own maybe :)

 

2. in some classes (e.g. pet_manager_martin)

	push_event	//  i5
	push_const 212
	add

instead of

push_reg_sp
fetch_i

 

Edited by MasterToma
Posted

Original OBJ + Decompiled source + Recompiled OBJ: https://mega.nz/#!SSJ0FQ7L!EPXTDOTcGmy4QGJPIgZ7jMY7-AVQ9pcq_xfEHilwJzQ

Almost no differences. Only missed jump, as you mentioned.

Replaces made on both OBJs:
L\d+ -> L0
S\d+ -> L0
\r\nL0\r\n -> \r\n

Hope you would like the "((((((((((((((((((((((((((((((((((((((((" in decompiled source :D.

Posted (edited)

Well I think it's not so hard to do proper (), if this info present in ai.obj. But I understand your sarcasm.

Why should I replace labels If I ignore them during diff?

 

I have 35 files with differences (labels are ignored, and few more filters are ignored), but you don't want to hear :) And it's not "only jump" Okay I will fix it manually, not a big deal.

 

Tnx for your work, this decompiler at least somehow usefull

Edited by MasterToma
Posted (edited)
47 minutes ago, MasterToma said:

And it's not "only jump"

I've shared compiled OBJs right before your post. There's only 19 differences, and all is missing jump.

Those missing jumps might be a breaks inside if inside select. I have an old issue for it.
Idk, may be we're using different decompilers or something :)

Anyway, smiles mode now enabled by default in branch c1-support.
And you have only 35 files of 2200, I think it's not so bad.

Edited by verbrannt

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



  • Posts

    • 🔥 Launch was a success! Over 500 players joined L2Elixir on opening day, and we are holding a steady 420–450 online! We faced extortion attempts and heavy DDoS attacks, but our protections held strong — even if the cost was far higher than expected. What matters is we fought back and kept the server online for you. ⚔️ 💙 Our priority is simple: Deliver a stable, fair, and growing server that will evolve for years to come. We continue to invest in protections, advertising, and development — and we won’t stop. All we ask from YOU is one thing: 👉 Keep playing. The more active the community is, the faster the server grows. 💠 Important Note: We have no paid clans or CPs, no “boosted” groups, no unfair benefits. Everyone has an equal chance to progress and compete. Thank you to everyone who joined, supported, and believed in this project. Let’s make L2Elixir great again — even in 2025–2026! 🚀   Website: https://l2elixir.org/ Discord: https://discord.gg/5ydPHvhbxs   @Atom Can you please move to Private Servers? Thanks!
    • https://jumpshare.com/share/kIdeKALOhgtMKpBKqxpg Test Equip Armors-> FullPlate, Gloves, Legs, Chest , Boots
    • 黑色星期五 — 为您的流量提供高级福利 仅在11月28日,我们的特别促销码可为您提供13%的商店折扣。 促销码: BLACKFRIDAY (13% 折扣) 您可以通过我们的网站或 Telegram 机器人在商店购物! 有效链接: 数字商品商店(网站): 前往 商店 Telegram 机器人: 前往 – 通过 Telegram Messenger 方便访问商店。 其他服务: 虚拟号码服务: 前往 用于购买 Telegram Stars 的机器人: 前往 – 快速且优惠地在 Telegram 中购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们向您呈现当前的 促销和特惠活动 列表,用于购买我们服务的产品和服务: 1. 您可以在首次购买时使用促销码:SOCNET(15% 折扣) 2. 获取 $1 商店余额或 10–20% 折扣 — 只需在我们网站注册后发送您的用户名,格式如下:“SEND ME BONUS, MY USERNAME IS...” — 您需要在我们的论坛帖子中写下这句话! 3. SMM 面板首次试用可获得 $1:只需在我们的网站(支持)提交主题为“Get Trial Bonus”的工单。 4. 我们的 Telegram 频道和 Stars 购买机器人每周都会举办 Telegram Stars 抽奖活动! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式与支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ 邮箱: solomonbog@socnet.store
    • BLACK FRIDAY — PREMIUM BENEFITS FOR YOUR TRAFFIC Only on November 28 our special promo code gives you a 13% discount in the store. PROMO CODE: BLACKFRIDAY (13% Discount) Shop in our store on the website or via the Telegram bot! Active links: Digital goods store (Website): Go Store Telegram bot: Go – convenient access to the store via Telegram messenger. Other services: Virtual numbers service: Go Telegram bot for purchasing Telegram Stars: Go – fast and profitable purchase of stars in Telegram. SMM Panel: Go – promotion of your social media accounts. We want to present you the current list of promotions and special offers for purchasing our service's products and services: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 to your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write this in our forum thread! 3. Get $1 for the first trial start of the SMM Panel: just open a ticket with the subject "Get Trial Bonus" on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and Support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock