View Single Post
  #1  
Old 07-03-2010, 05:02 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default COMMITTED: $oncursor

Similar to $hasitem, $oncursor checks the front item on the cursor for a specific item id.

Code:
Index: embparser.cpp
===================================================================
--- embparser.cpp	(revision 1581)
+++ embparser.cpp	(working copy)
@@ -532,6 +532,19 @@
 		}
 	}
 
+	// $oncursor
+	if(mob && mob->IsClient()) {
+		string hashname = packagename + std::string("::oncursor");
+		perl->eval(std::string("%").append(hashname).append(" = ();").c_str());
+		char *hi_decl = NULL;
+		int itemid = mob->CastToClient()->GetItemIDAt(30);
+		if(!HASITEM_ISNULLITEM(itemid)) {
+			MakeAnyLenString(&hi_decl, "push (@{$%s{%d}},%d);",hashname.c_str(),itemid,30);
+			perl->eval(hi_decl);
+			safe_delete_array(hi_decl);
+		}
+	}
+
 	//do any event-specific stuff...
 	switch (event) {
 		case EVENT_SAY: {
Usage:
Code:
if ($oncursor{67415}) { #Stone of Entry
  quest::say("$name has the item on the cursor.");
}
else {
  quest::say("$name is not holding that item.");
}
Works great for situations like this: The keyholder must hold the Stone of Entry on his/her cursor and say, "I wish to enter."
Reply With Quote