Server Totals
Deglos - (2)
Underdark - (1)
Visimontium - (1)
Ferrell - (0)
Elysia - (0)
M'Chek - (0)
Le'Or - (0)
Wilderness - (0)
Mikona - (0)
Total players: 4
Gallery

Links Menu

Script for all avlis to use if wanting

Moderators: Nighthawk4, Dungeon Masters

Script for all avlis to use if wanting

PostAuthor: SlicerDicer » Tue Aug 05, 2003 9:04 am

edit: this script now allows you to only charge once per week so the player cant pay over and over. at the end of the week you remove the token from the chest and put it in trashcan and cycle starts over again.

Code: Select all
// Created Tuesday, August 4 2003
// Created by, SlicerDicer
// Code is free to be chopped, hacked, reverse engineered and eaten for breakfast
/* The script makes it so you can check and see if the payslip is in the chest if
it is then it wont charge you again. if its not then it will charge you rent. simple
yet effective.*/


void main()
{

object oRentChest   = GetObjectByTag("OAA_Rent_Chest");  // chest payment goes in
object oPC          = GetPCSpeaker();   // player character ident
int iRent           = 1000;      // rent cost


if (!GetIsPC(oPC)) return;

if (GetItemPossessedBy(oRentChest, "oaa_payslip_001")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_001")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_001",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_002")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_002")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_002",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_003")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_003")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_003",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_004")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_004")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_004",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_005")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_005")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_005",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_006")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_006")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_006",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_007")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_007")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_007",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_008")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_008")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_008",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_009")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_009")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_009",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_010")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_010")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_010",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_011")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_011")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_011",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_012")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_012")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_012",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_013")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_013")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_013",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_014")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_014")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_014",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_015")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_015")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_015",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_016")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_016")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_016",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_017")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_017")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_017",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_018")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_018")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_018",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_019")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_019")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_019",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_020")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_020")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_020",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_021")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_021")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_021",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_022")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_022")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_022",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_023")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_023")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_023",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_024")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_024")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_024",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_025")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_025")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_025",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_026")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_026")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_026",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_027")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_027")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_027",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_028")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_028")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_028",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_029")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_029")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_029",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_030")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_030")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_030",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_031")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_031")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_031",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_032")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_032")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_032",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_033")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_033")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_033",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_034")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_034")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_034",oRentChest);SpeakString("Thank ye for paying yer rent!");}
if (GetItemPossessedBy(oRentChest, "oaa_payslip_035")!= OBJECT_INVALID){SpeakString("Ye already payed yer rent this month!");}
else
if (GetItemPossessedBy(oPC, "oaa_rkey_035")!= OBJECT_INVALID){AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);CreateItemOnObject("oaa_payslip_035",oRentChest);SpeakString("Thank ye for paying yer rent!");}

 }



i will be editing this when i 100% complete it. it is part of what i am working on for a player run inn. what this script does is checks to see what key the oPC has from there it charges the oPC 1000 gp and puts the 1000gp in a chest along with a token that way you know room 1 has payed etc. this is just the first part of the script. modify the tags of the items as needed to create what you want to do. more will come soon promise.
Last edited by SlicerDicer on Tue Aug 05, 2003 7:33 pm, edited 2 times in total.
User avatar
SlicerDicer
Apprentice Scholar
 
Posts: 544
Joined: Fri Mar 07, 2003 9:45 am
Location: Rio Rancho NM

PostAuthor: HarveyH » Tue Aug 05, 2003 9:29 am

Doesn't NWN scripting allow some kind of loop structure?

It looks kinda silly, 35 'IF' statements with as only difference a number increasing from 1 to 35...

Something like:
Code: Select all
for i in range(25):
   if (GetItemPossessedBy(oPC, "oaa_rkey_"+i)!= OBJECT_INVALID)
      {AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));
      CreateItemOnObject   ("oaa_inn_payment",oRentChest,iRent);
      CreateItemOnObject("oaa_payslip_"+i,oRentChest);
      SpeakString("Thank ye for paying yer rent!");}
Last edited by HarveyH on Tue Aug 05, 2003 10:03 am, edited 2 times in total.
User avatar
HarveyH
Scholar
 
Posts: 1099
Joined: Fri Feb 21, 2003 12:33 pm
Location: Nijmegen

PostAuthor: Sindol » Tue Aug 05, 2003 9:37 am

AAAARGH MY EYES!

I'm not saying I'm the best scripter there is, because I'm not, but this is probably the most unreadable script I've ever encountered, including my own. :o
So much fun,
yet so little time to enjoy it.
- Sindol
User avatar
Sindol
Team Member; Retired with Honors
 
Posts: 6487
Joined: Mon Jan 06, 2003 4:23 pm
Location: Nijmegen - Netherlands (GMT+1)

PostAuthor: SlicerDicer » Tue Aug 05, 2003 9:44 am

well i am sorry if i cant post it the way it looks in the toolset beacuse of the way the forums work. but yes it is quite unreadable.
also if you want to fix it with the loop function go for it. i tryed to get the loop working tons of times and could not so i just gave up and did a shitload of ifs. sorry btw the above code is modifyed
User avatar
SlicerDicer
Apprentice Scholar
 
Posts: 544
Joined: Fri Mar 07, 2003 9:45 am
Location: Rio Rancho NM

PostAuthor: Vlad Bogdanov » Tue Aug 05, 2003 9:47 am

If you post the version with the loop that's not working, we can all stare at it and try to fix it. I assume you have been using IntToString() and string concatenation with "+" right?

Totally pulling this out of my behind:

Code: Select all
int i;
string sI;

for (i=1; i<36; i++)
{

  sI = IntToString(i);
  if (GetItemPossessedBy(oRentChest, "oaa_payslip_"+sI)!= OBJECT_INVALID)
  {
    SpeakString("Ye already payed yer rent this month!");
  }
  else
  if (GetItemPossessedBy(oPC, "oaa_rkey_"+sI)!= OBJECT_INVALID)
  {
    AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));
    CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);
    CreateItemOnObject("oaa_payslip_"+sI,oRentChest);
    SpeakString("Thank ye for paying yer rent!");
  }
}



Note that this strips the leading zeroes. If it's a problem you can but them back in, but it should work regardless if you keep doing it in the same way everywhere.

EDIT: To Neve

Hey Dutchie! Looks like you missed an IntToString on the second CreateItemOnObject :D
Last edited by Vlad Bogdanov on Tue Aug 05, 2003 10:51 am, edited 5 times in total.
Thus spake Vladimir Florovich Bogdanov

Vlad Bogdanov
Newbie
 
Posts: 9
Joined: Thu Jul 31, 2003 9:20 am
Location: Delft, The Netherlands

PostAuthor: Neve » Tue Aug 05, 2003 9:49 am

Harvey : That could work, just don't forget to convert the "i" to a string :)

Code: Select all
const number = 25;
object oPC =<???>;
int i = 1;

while(i<=number){
      GetItemPossessedBy(oPC, "oaa_rkey_" + IntToString(i))
      AssignCommand(oPC, TakeGoldFromCreature(iRent, oPC, TRUE));
      CreateItemOnObject("oaa_inn_payment", oRentChest, iRent);
      CreateItemOnObject("oaa_payslip_"+i, oRentChest);
      SpeakString("Thank ye for paying yer rent!");
      i++;
}
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
User avatar
Neve
Prince of Bloated Discourse
 
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands

PostAuthor: SlicerDicer » Tue Aug 05, 2003 9:58 am

thanks neve i thought about contacting you but you have no msger :)
User avatar
SlicerDicer
Apprentice Scholar
 
Posts: 544
Joined: Fri Mar 07, 2003 9:45 am
Location: Rio Rancho NM

PostAuthor: HarveyH » Tue Aug 05, 2003 10:02 am

*shakes head*
Didn't I tell them to base this NWN scripting thing on python? Yes I did. But did they listen? No they didn't. The fekkers.
User avatar
HarveyH
Scholar
 
Posts: 1099
Joined: Fri Feb 21, 2003 12:33 pm
Location: Nijmegen

PostAuthor: KinX » Tue Aug 05, 2003 10:09 am

bah, python.
Never argue with an idiot, they'll drag you down to their level and beat you with experience

Image

This statement is false
User avatar
KinX
Elder Sage
 
Posts: 4968
Joined: Tue Sep 10, 2002 2:53 pm
Timezone: GMT +1

PostAuthor: SlicerDicer » Tue Aug 05, 2003 10:44 am

when i get this code completed properly i would like to talk to all interested partys who are wanting to create player run rental rooms. if you want to contact me and work with me on this you can i sure could use the help.
User avatar
SlicerDicer
Apprentice Scholar
 
Posts: 544
Joined: Fri Mar 07, 2003 9:45 am
Location: Rio Rancho NM

PostAuthor: Silk » Tue Aug 05, 2003 2:18 pm

Holy shit... I think my brain just exploded. :shock:
I think you need to "optimize" your code there...
Silk

Member of the MadK@t lover's group.
User avatar
Silk
Co-Founder
 
Posts: 6665
Joined: Fri Sep 14, 2001 6:47 pm

PostAuthor: Manuel the White » Tue Aug 05, 2003 2:42 pm

Does NWScript have a switch/select case control structure?
ACTIVE CHARACTERS: Casey Landry, Jessie Morrice
SOMETIMES CHARACTERS: Silinde, Luthias
INACTIVE CHARACTERS: Manuel (the White) Thay't Le'Megen, Zven Reaplenoose, Drashter Volterz
User avatar
Manuel the White
Team Member; Retired with Honors
 
Posts: 7424
Joined: Wed Mar 05, 2003 6:45 pm

PostAuthor: Neve » Tue Aug 05, 2003 2:44 pm

Code: Select all
switch( ... ){
   case 1 : ...; break;
   case 2 : ...; break;
}


;)
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
User avatar
Neve
Prince of Bloated Discourse
 
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands

PostAuthor: SlicerDicer » Tue Aug 05, 2003 7:41 pm

Silk wrote:Holy shit... I think my brain just exploded. :shock:
I think you need to "optimize" your code there...


i am workin on it as i said before i posted the code so i could get help beacuse i could not get the while function working

i think i just realised why my code was not working :) hehe

Code: Select all
void main()
{
object oPC = GetPCSpeaker();
object oRentChest = GetObjectByTag("OAA_Rent_Chest");
object oRentKey = OBJECT_INVALID;
int iPCgold;
int iRent = 1000;               // this is how much is payed to the Guild per rent time
string sKeyName = "OOA_rkey_";  // this is the base name of all the room keys
int iIter = 1;                  // this is the variable that counts through the iterations
int irun = TRUE;                // this keeps the while loop running
int iLimit = 35;                // total number of rooms

while (irun)
    {
    if ((iIter&&10)>=1)
        {
         oRentKey = GetItemPossessedBy(oPC,sKeyName + "0" + IntToString(iIter));
        }
        {
         oRentKey = GetItemPossessedBy(oPC,sKeyName + "00" + IntToString(iIter));
        }
    iIter++;
    if (iIter>iLimit) { irun = FALSE; }
    if (oRentKey != OBJECT_INVALID) { irun = FALSE; }
    }

if (oRentKey == OBJECT_INVALID)
    {
        SpeakString("you fool dont try to pay if you dont have a key !");
    }
    {
    if(GetGold(oPC) > iRent)
        {
            TakeGoldFromCreature(1000, oPC, 1);
            CreateItemOnObject("ooa_payslip_"+ GetStringRight(GetTag(oRentKey),3),oRentChest, 1);
            CreateItemOnObject("oaa_inn_payment",oRentChest,iRent);
        }
        {
            SpeakString("Thank ye for paying yer rent.");
        }
    }
}


ok the code here is kinda sorta working it takes the gold and puts the gold in the chest. problem being is it is not putting in the payslip... any ideas? also i still need to write the rest with the if/else so it wont allow to pay once but that is not may major worry right now
User avatar
SlicerDicer
Apprentice Scholar
 
Posts: 544
Joined: Fri Mar 07, 2003 9:45 am
Location: Rio Rancho NM

PostAuthor: Neve » Thu Aug 07, 2003 12:26 pm

Code: Select all
if ((iIter&&10)>=1)

This is weird... What are you checking for >= 1 here ? '&&' is read as "AND", maybe you mean '+' instead of '&&' ?

The way I read it is iIter>=1 && 10>=1 . You assign a 1 to iIter, so this check is always true.

What does this do ?
string sKeyName = "OOA_rkey_";
GetItemPossessedBy(GetPCSpeaker(),sKeyName + "0" + IntToString(iIter));

How about :
GetItemPossessedBy(GetPCSpeaker(), "OOA_rkey_0" + IntToString(iIter));

Also, don't use { and } so much =P
If(true) blah; can be done without { }
If(true) {blah; blah;} needs compounds

Code: Select all
void main(){
    object oRentKey   = OBJECT_INVALID;
    int    iRent      = 1000;
    int    iIter      = 1;
    int    irun       = TRUE;
    int    iLimit     = 35;

    while(irun){
        if((iIter&&10) >= 1){
            oRentKey = GetItemPossessedBy(GetPCSpeaker(), "OOA_rkey_0"  + IntToString(iIter));
            oRentKey = GetItemPossessedBy(GetPCSpeaker(), "OOA_rkey_00" + IntToString(iIter));
            iIter++;
        }

       if((iIter > iLimit) || (oRentKey != OBJECT_INVALID)) irun = FALSE;
       else SpeakString("you fool dont try to pay if you dont have a key !");

        if(GetGold(GetPCSpeaker()) > iRent){
            TakeGoldFromCreature(1000, GetPCSpeaker(), TRUE);
            CreateItemOnObject("ooa_payslip_" + GetStringRight(GetTag(oRentKey), 3), GetObjectByTag("OAA_Rent_Chest"), 1);
            CreateItemOnObject("oaa_inn_payment", GetObjectByTag("OAA_Rent_Chest"), iRent);
            SpeakString("Thank ye for paying yer rent.");
        }
    }
}
- As you gaze unknowingly into the seemingly infinite depths of the optics of this altogether passionate embodiment of insatiability, you experience a gradual realisation that the heavily-embellished vocabulary scattered lavishly throughout the sentence you are currently reading is indisputably nothing greater than a generous ration of masculine bovine faeces.
User avatar
Neve
Prince of Bloated Discourse
 
Posts: 192
Joined: Mon Apr 14, 2003 4:09 pm
Location: The Netherlands

PostAuthor: Brannor » Thu Aug 07, 2003 1:14 pm

Silk wrote:Holy shit... I think my brain just exploded. :shock:
I think you need to "optimize" your code there...

Well actually unrolling loops is better for performance.
But a loop is a LOT better to read.
All posts are made as a player unless otherwise noted or in the team boards.
-------------------------------------------------------
Roses are 0xFF0000
Violetts are 0x0000FF
all my base
are belong to you

Brannor
Scholar
 
Posts: 1435
Joined: Tue Nov 19, 2002 7:12 am
Location: Bavaria / Germany

PostAuthor: SlicerDicer » Mon Aug 11, 2003 8:35 am

Brannor wrote:
Silk wrote:Holy shit... I think my brain just exploded. :shock:
I think you need to "optimize" your code there...

Well actually unrolling loops is better for performance.
But a loop is a LOT better to read.


hehe well that is a shitload of unrolling!
User avatar
SlicerDicer
Apprentice Scholar
 
Posts: 544
Joined: Fri Mar 07, 2003 9:45 am
Location: Rio Rancho NM

PostAuthor: Alexandru Stanicu » Mon Aug 11, 2003 10:45 pm

Hey Slicer... what if you put a box the rent chest for each room (and name it according to room number) and have the gold placed in that box... would that work?

-Alex
I ain't as good as I once was, But I'm as good once as I ever was...


:devil: 4evar!
User avatar
Alexandru Stanicu
Legacy DM
Legacy DM
 
Posts: 14077
Joined: Sun Oct 20, 2002 10:59 pm
Location: Texas
Timezone: CST
DM Avatar: The Hammer


Return to NWN Scripting

Who is online

Registered users: No registered users