WoHP Homepage    Register    Login    Forum    Search    FAQ

Board index » General » Miscellanea




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Script Help?
 Post Posted: Sun Mar 02, 2008 6:25 pm 
Offline
Game Master
Game Master
User avatar

Joined: Mon Oct 29, 2007 12:00 am
Posts: 1604
I am having trouble writing a script for a mod I am toying around with. Its suppose to be a simple transition restriction script; or so I thought.

I keep getting the following error message on Line 10: "ERROR: VARIABLE DEFINED WITHOUT TYPE"
Code:
void main()
{

object oPC = GetLastUsedBy();

if (!GetIsPC(oPC)) return;

if (GetItemPossessedBy(oPC, "RRToken")== OBJECT_INVALID)
   {
   sDeny="This portal needs the RR Token to activate. You apparently do not possess an RR Token.";

   SendMessageToPC(oPC, sDeny);

   return;
   }

object oTarget;
location lTarget;
oTarget = GetWaypointByTag("RRenter");

lTarget = GetLocation(oTarget);

if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

AssignCommand(oPC, ClearAllActions());

AssignCommand(oPC, ActionJumpToLocation(lTarget));

}


Thank you to anyone who can help. :)

_________________
Image


Top 
 Profile  
 
 Post subject:
 Post Posted: Sun Mar 02, 2008 7:05 pm 
Offline
Forum Sixth Year
Forum Sixth Year
User avatar

Joined: Wed Jun 06, 2007 12:00 am
Posts: 263
Location: Hufflepuff Common.
Whoa... That looks like Java.

Shouldn't that first line be "public static void main(String[] args)"?


Top 
 Profile  
 
 Post subject:
 Post Posted: Mon Mar 03, 2008 9:15 am 
Offline
Azkaban Escapee
Azkaban Escapee
User avatar

Joined: Sun Sep 23, 2007 12:00 am
Posts: 1336
Location: Hibernia
Nah, pretty much all NWN scripts start with
Code:
void main()

_________________
Local Lurker and Knower of the Unknown and Unknowable. Also a bit full of itself, and an occasional prick.


Top 
 Profile  
 
 Post subject:
 Post Posted: Mon Mar 03, 2008 3:44 pm 
Offline
Forum Seventh Year
Forum Seventh Year

Joined: Fri Jun 30, 2006 12:00 am
Posts: 409
Location: Arizona
D_Black, Could you a bit more specific? What are you dealing with Exactly? I know it a Transition Restriction, but for what?


Top 
 Profile  
 
 Post subject:
 Post Posted: Mon Mar 03, 2008 4:32 pm 
Offline
Game Master
Game Master
User avatar

Joined: Mon Oct 29, 2007 12:00 am
Posts: 1604
Its to be placed on a placeable object in the "On Used" of the script categories.

Not sure exactly what specifics you're looking for. If you mean its function then its suppose to be an item that when clicked transports you t a different area. Except if you don't have the required item to transition than you get a system message saying that you can't pass unless you have the item...

_________________
Image


Top 
 Profile  
 
 Post subject:
 Post Posted: Mon Mar 03, 2008 5:36 pm 
Offline
Forum Fifth Year
Forum Fifth Year
User avatar

Joined: Fri Jul 13, 2007 12:00 am
Posts: 180
Location: Brazil - Rio de Janeiro
There you go, in case you need more help, ask. :)



Quote:
void main()
{

object oPC = GetLastUsedBy();

if (!GetIsPC(oPC)) return;

if (GetItemPossessedBy(oPC, "RRToken")== OBJECT_INVALID)
{

//Every single variable you use must be declared. :)
string sDeny;

sDeny="This portal needs the RR Token to activate. You apparently do not possess an RR Token.";

SendMessageToPC(oPC, sDeny);

return;
}

object oTarget;
location lTarget;
oTarget = GetWaypointByTag("RRenter");

lTarget = GetLocation(oTarget);

if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

AssignCommand(oPC, ClearAllActions());

AssignCommand(oPC, ActionJumpToLocation(lTarget));

}




If you want something more organized.


Quote:
//DiaboSatan likes to help :D

void main()
{

object oPC = GetLastUsedBy();
//Checks if the player has the item, if positive jump him to "RRenter"
if (GetItemPossessedBy(oPC, "RRToken")!=OBJECT_INVALID)
{
object oTarget = GetWaypointByTag("RRenter");
location lTarget = GetLocation(oTarget);
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, ActionJumpToLocation(lTarget));
}
//If negative, he'll get that message.
else
{
string sDeny="This portal needs the RR Token to activate. You apparently do not possess an RR Token.";
SendMessageToPC(oPC, sDeny);
}
}


Top 
 Profile  
 
 Post subject:
 Post Posted: Mon Mar 03, 2008 7:46 pm 
Offline
Azkaban Dementor
Azkaban Dementor
User avatar

Joined: Wed Jun 21, 2006 12:00 am
Posts: 2356
I love how it emoticon'd the smiley in your code comment.


Top 
 Profile  
 
 Post subject:
 Post Posted: Tue Mar 04, 2008 4:17 am 
Offline
Forum Fifth Year
Forum Fifth Year
User avatar

Joined: Fri Jul 13, 2007 12:00 am
Posts: 180
Location: Brazil - Rio de Janeiro
Neither Delphi nor Dev C++ are able to do that emoticon, by the way :D
hahahahaha


Top 
 Profile  
 
 Post subject:
 Post Posted: Thu May 22, 2008 9:32 pm 
Offline
Game Master
Game Master
User avatar

Joined: Mon Oct 29, 2007 12:00 am
Posts: 1604
I finally got around to testing out that script and it works great. Thanks for the help. :D

_________________
Image


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 9 posts ] 

Board index » General » Miscellanea


Who is online

Users browsing this forum: No registered users and 1 guest

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron