Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Help with js.

Newbie Spellweaver
Joined
Nov 26, 2008
Messages
7
Reaction score
0
Hi guys, i have the next problem.
Im trying to make a cube npc, there's no error on the console, but still not working.

Code:
var status = -1;
var equip;
var selected;
var state;
function start() { 
        cm.sendNext("Hello! I can cube your items, please go ahead.");
	}
 function action(mode, type, selection) { 
   if (mode < 1)
        cm.dispose();
    else {
        if (mode == 1 && status != 3)
            status++;
        if (status == 0)
		cm.sendSimple("Wich item would you like to cube?\r\n" + cm.EquipList(cm.getC()));
        else if (status == 1) {
		selected = selection;
		state = equip.getState();
		equip = cm.getEquip(selection);
		cm.sendOk("What would you like to edit on your #b#t"+equip+"#? #k:)");
		} else if (status == 2){
		cm.sendOk("Hello!");
		}


	 }	
	cm.dispose();
 }

The problem is, that when i choose the item i want to cube the chat window closes immediately.

Code:
		cm.sendSimple("Wich item would you like to cube?\r\n" + cm.EquipList(cm.getC()));

Thats the last line that the npc reads.
Thanks in adv.
 
Custom Title Activated
Loyal Member
Joined
Jan 18, 2010
Messages
3,109
Reaction score
1,139
Code:
state = equip.getState();
equip = cm.getEquip(selection);
For starters, you haven't even declared equip yet, yet you define "state" which uses a reference to "equip" of null.

Code:
#b#t"+equip+"#?
Next off, you do + equip + in your message, but are you sure cm.getEquip is an integer, or an actual object of type Item? You likely need to do + equip.getItemId() + instead.
 
Upvote 0
Back
Top