need help at a script for interlude.

Find the proper support area, Saga-Version.
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
Darkfeiter
Posts: 329
Joined: Tue Dec 16, 2008 6:48 pm

need help at a script for interlude.

Post by Darkfeiter »

here code :

Code: Select all

 if (_vipRewardAmount > 1)                {                    sm = new SystemMessage([color=#FF0000]SystemMessage[/color].EARNED_S2_S1_s);                    sm.addItemName(_vipReward);                    sm.addNumber(_vipRewardAmount);                    player.sendPacket(sm);                }                else                {                    [color=#FF0000]systemMessage[/color] = new SystemMessage([color=#FF0000]SystemMessageId[/color].EARNED_ITEM);                    sm.addItemName(_vipReward);                    player.sendPacket(sm);                }
i get this errors import to systemmessage is in thx for help
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: need help at a script for interlude.

Post by janiii »

what errors?

check that you use SystemMessageId when pointing to a message id. check your variable names. when using eclipse, use code completion if you are not sure about enum names, etc.

Code: Select all

                if (_vipRewardAmount > 1)                {                    sm = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);                    sm.addItemName(_vipReward);                    sm.addNumber(_vipRewardAmount);                    player.sendPacket(sm);                }                else                {                    sm = new SystemMessage(SystemMessageId.EARNED_ITEM);                    sm.addItemName(_vipReward);                    player.sendPacket(sm);                }
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
Darkfeiter
Posts: 329
Joined: Tue Dec 16, 2008 6:48 pm

Re: need help at a script for interlude.

Post by Darkfeiter »

the red thinga are the errors so donno what to make now :S
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: need help at a script for interlude.

Post by janiii »

check my code. else if you say the red text are errors, we need to know what errors.
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
Darkfeiter
Posts: 329
Joined: Tue Dec 16, 2008 6:48 pm

Re: need help at a script for interlude.

Post by Darkfeiter »

Code: Select all

public static void rewardNotVIP(){		for (L2PcInstance player : _playersNotVIP){			if (player != null) {				PcInventory inv = player.getInventory(); 				if (ItemTable.getInstance().createDummyItem(_notVipReward).isStackable())                    inv.addItem("VIP Event: ", _notVipReward, _notVipRewardAmount, player, null);                else                {                    for (int i=0;i<=_notVipRewardAmount-1;i++)                        inv.addItem("VIP Event: ", _notVipReward, 1, player, null);                } 				SystemMessage sm; 				if (_vipRewardAmount > 1)                {                    sm = new SystemMessage([color=#FF0000]SystemMessageId[/color].EARNED_S2_S1_S);                    sm.addItemName(_vipReward);                    sm.addNumber(_vipRewardAmount);                    player.sendPacket(sm);                }                else                {                    sm = new SystemMessage([color=#FF0000]SystemMessageId[/color].EARNED_ITEM);                    sm.addItemName(_vipReward);                    player.sendPacket(sm);                } 				StatusUpdate su = new StatusUpdate(player.getObjectId());                su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());                player.sendPacket(su);                 NpcHtmlMessage nhm = new NpcHtmlMessage(5);                TextBuilder replyMSG = new TextBuilder("");                 replyMSG.append("<html><head><body>Your team has won the event. Your inventory now contains your reward.</body></html>");                 nhm.setHtml(replyMSG.toString());                player.sendPacket(nhm);			}		}	} 	public static void rewardVIP(){		for (L2PcInstance player : _playersVIP){			if (player != null && !player._isTheVIP) {				PcInventory inv = player.getInventory(); 				if (ItemTable.getInstance().createDummyItem(_vipReward).isStackable())                    inv.addItem("VIP Event: ", _vipReward, _vipRewardAmount, player, null);                else                {                    for (int i=0;i<=_vipRewardAmount-1;i++)                        inv.addItem("VIP Event: ", _vipReward, 1, player, null);                } 				SystemMessage sm; 				if (_vipRewardAmount > 1)                {                    sm = new SystemMessage(SystemMessage.EARNED_S2_S1_s);                    sm.addItemName(_vipReward);                    sm.addNumber(_vipRewardAmount);                    player.sendPacket(sm);                }                else                {                    sm = new SystemMessage(SystemMessage.EARNED_ITEM);                    sm.addItemName(_vipReward);                    player.sendPacket(sm);                } 				StatusUpdate su = new StatusUpdate(player.getObjectId());                su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());                player.sendPacket(su);                 NpcHtmlMessage nhm = new NpcHtmlMessage(5);                TextBuilder replyMSG = new TextBuilder("");                 replyMSG.append("<html><head><body>Your team has won the event. Your inventory now contains your reward.</body></html>");                 nhm.setHtml(replyMSG.toString());                player.sendPacket(nhm);			}			else if (player._isTheVIP){					PcInventory inv = player.getInventory(); 					if (ItemTable.getInstance().createDummyItem(_theVipReward).isStackable())	                    inv.addItem("VIP Event: ", _theVipReward, _theVipRewardAmount, player, null);	                else	                {	                    for (int i=0;i<=_theVipRewardAmount-1;i++)	                        inv.addItem("VIP Event: ", _theVipReward, 1, player, null);	                } 					SystemMessage sm; 					if (_theVipRewardAmount > 1)	                {	                    sm = new SystemMessage(SystemMessage.EARNED_S2_S1_s);	                    sm.addItemName(_theVipReward);	                    sm.addNumber(_theVipRewardAmount);	                    player.sendPacket(sm);	                }	                else	                {	                    sm = new SystemMessage(SystemMessage.EARNED_ITEM);	                    sm.addItemName(_theVipReward);	                    player.sendPacket(sm);	                }} 					StatusUpdate su = new StatusUpdate(player.getObjectId());	                su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());	                player.sendPacket(su); 	                NpcHtmlMessage nhm = new NpcHtmlMessage(5);	                TextBuilder replyMSG = new TextBuilder(""); 	                replyMSG.append("<html><head><body>You team have won the event. Your inventory now contains your reward.</body></html>"); 	                nhm.setHtml(replyMSG.toString());	                player.sendPacket(nhm);			}		}	} 
s6 x systemmessage error so donno have prob with forum every letter will get up the screen -.-
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: need help at a script for interlude.

Post by janiii »

ok, then use SystemMessage instead of SystemMessageId . you should always check other code - like you see a couple of lines below the error, there are same lines working with SystemMessage . check that the error code is same as the working code. or just check how system messages are created and if the "EARNED_ ..." id exists in your system message (id) class. just follow the code..
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
Darkfeiter
Posts: 329
Joined: Tue Dec 16, 2008 6:48 pm

Re: need help at a script for interlude.

Post by Darkfeiter »

like tvt systemmessage ?

Code: Select all

SystemMessage systemMessage = null; 				if (reward[1] > 1)				{					systemMessage = new SystemMessage(SystemMessageId.EARNED_S2_S1_S);					systemMessage.addItemName(reward[0]);					systemMessage.addNumber(reward[1]);				}				else				{					systemMessage = new SystemMessage(SystemMessageId.EARNED_ITEM);					systemMessage.addItemName(reward[0]);				} 				playerInstance.sendPacket(systemMessage);			}
i can try but i think i crash the code :P
User avatar
janiii
L2j Veteran
L2j Veteran
Posts: 4269
Joined: Wed May 28, 2008 3:15 pm
Location: Slovakia

Re: need help at a script for interlude.

Post by janiii »

little eclipse study for you:
for organizing imports in eclipse, use ctrl+shift+o -> this will add/remove classes from the imports. like probably you dont have SystemMessageId imported (properly), so eclipse can handle this for you with ctrl+shift+o .
then for code completion, use ctrl+space on an object or part of a code while writing and eclipse will suggest you the code to add (e.g. write SystemMessageI and hit ctrl+space right after it, eclipse will suggest you SystemMessageId and will also import it for you. then write .EARNED and again hit ctrl+space - you will get available system messages suggested if there exists some that start with EARNED).

you should learn using eclipse, it is a nice tool that can help you with coding and you will not need to ask here for such support like this, as it has nothing to do with l2j but with your eclipse skills..

//anyway, topic moved to legacy support as it has nothing to do with user contribution! please follow forum rules and check the forum sections!
DO NOT EVEN TRY TO MESS WITH ME!
forum flOOder dancing dEVILoper
I don't give private support - PM will be ignored!
Darkfeiter
Posts: 329
Joined: Tue Dec 16, 2008 6:48 pm

Re: need help at a script for interlude.

Post by Darkfeiter »

ok thx jani its done :D
Post Reply