Page 1 of 1
Team gate new problem
Posted: Fri Jun 23, 2006 12:23 pm
by Poi
Ok here is my script:
Code: Select all
use uo;
program itemstone( who )
var items := EnumerateItemsInContainer(who.backpack);
var pack1 := who.backpack;
foreach thing in items
if(thing.objtype = 0x99a1)
DestroyItem(0x99a1);
DestroyItem(0x99a2);
DestroyItem(0x99a3);
DestroyItem(0x99a4);
DestroyItem(0x99a5);
DestroyItem(0x99a6);
DestroyItem(0x99a7);
else
CreateItemInContainer (pack1, 0x99a1, 1);
CreateItemInContainer (pack1, 0x99a2, 1);
CreateItemInContainer (pack1, 0x99a3, 1);
CreateItemInContainer (pack1, 0x99a4, 1);
CreateItemInContainer (pack1, 0x99a5, 1);
CreateItemInContainer (pack1, 0x99a6, 1);
CreateItemInContainer (pack1, 0x99a7, 1);
endif
endforeach
endprogram
My problem: when i step on the gate, it create about 15 of each of these items(i know why) but im not sure how to stop it... Any help?
Note:
I know why it creates around 15 of them, don't tell me.
Posted: Sat Jun 24, 2006 1:04 am
by CWO
hehe... also, DestroyItem needs a reference to the items... Meaning you need to find all of them in the pack before destroying them. You cant just put an objtype in there.
Posted: Sat Jun 24, 2006 2:57 am
by Gnafu
---- EDIT ----
Probably the correct version...
----- FIXED CODE -----
Code: Select all
use uo;
program itemstone( who )
var wpcis:=GetObjProperty(who, "isin");
if(!wpcis) //the cprop does not exists, so the pc is out
var pack1 := who.backpack;
local i;
var temp:=0x99a0; // useless initialization
for (i:=1; i<=7; i:=i+1)
temp:=(0x99a0+i);
CreateItemInContainer (pack1, temp, 1);
endfor
SetObjProperty(who, "isin", 1);
else // the pc is in
var items := EnumerateItemsInContainer(who.backpack);
foreach thing in items
if( (thing.objtype >= 0x99a1) && (thing.objtype <= 0x99a7))
DestroyItem(thing);
endif;
endforeach
EraseObjProperty( who, "isin" );
endif
endprogram
----- FIXED CODE -----
Posted: Sat Jun 24, 2006 9:40 am
by Poi
Ill test it and get back to you, thanks for tying

Posted: Sat Jun 24, 2006 9:52 am
by Poi
Its just a tad bit off from what i want, this one creates the items and when you go back thru deletes them and creates more, but i want it so when they go back thru it only deletes them
Posted: Sun Jun 25, 2006 5:06 am
by Gnafu
That script destroy or create the objects if they exists or not.
If exists more than one obj, it destroy only one.
If you tell me what does this script must help to do it will better for me to change it according to your wish...
Do you want a pg to have an object to use in a dng and then, when he comes back, destroy it?
And there must be only one ?
give me an example or something as:
"the pg have an empty backpack
he goes thru the gate and he receive an object to use in the zone
when he comes back he cannot bring back the object
so the script must destroy the object."
my questions will be:
"different pg can trade theese objects? or have more than one of each type?"
"how about come back thru with no objects?"
Posted: Sun Jun 25, 2006 6:37 am
by Poi
This is exactly what i want to do, i hopw you understand it:
Person goes thru the gate, gets a set of items to use for that zone, when he comes back thru the gate it just destroys those items so he doesnt have them anymore, but next time he comes thru he will get the items agian
Posted: Sun Jun 25, 2006 8:22 am
by Gnafu
Done.
I used a cprop to set the pc 'in' or 'out'.
Change the name of the cprop used if 'isin' is used in other scripts or you think 'djbethrstyhryh' , 'dtgdhg' or 'iujfndyb' are better
If the cprop exists, it means that the pc was in, so the script must destroy all the objects.
If the cprop doesn't exists, getobjproperty() returns an error, it means that the pc was out of the zone, so the script must create the items..
Probably in this way it will work but pay attention to some cases:
- The pc already have an object with that objtype
- The pc exit the zone without using the gate (rune, summon by staff..)
Bye bye
Posted: Sun Jun 25, 2006 11:33 am
by Poi
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\pol\scripts>ecompile.exe
EScript Compiler v1.03
Copyright (C) 1994-2003 Eric N. Swanson
Compiling: c:/pol/pkg/teamgates/itemstone.src
Your syntax frightens and confuses me.
Your syntax frightens and confuses me.
Error compiling statement at c:\pol\pkg\teamgates\itemstone.src, Line 2
Parse Error: Waaah!
Near: program itemstone( who )
File: c:\pol\pkg\teamgates\itemstone.src, Line 3
Execution aborted due to: Error compiling file
C:\pol\scripts>
Posted: Sun Jun 25, 2006 5:03 pm
by CWO
post the code you used. Theres an error somehwere in it.
Posted: Sun Jun 25, 2006 6:39 pm
by Poi
use uo;
program itemstone( who )
var wpcis:=GetObjProperty(who, 'isin');
if(!wpcis) //the cprop does not exists, so the pc is out
var pack1 := who.backpack;
local i;
var temp:=0x99a0; // useless initialization
for (i:=1; i<=7; i:=i+1)
temp:=(0x99a0+i);
CreateItemInContainer (pack1, temp, 1);
endfor
else // the pc is in
var items := EnumerateItemsInContainer(who.backpack);
foreach thing in items
if( (thing.objtype >= 0x99a1) && (thing.objtype <= 0x99a7))
DestroyItem(thing);
endif;
endforeach
EraseObjProperty( who, 'isin' );
endif
endprogram
Posted: Sun Jun 25, 2006 9:52 pm
by CWO
use double quotes instead of single quotes? "isin" instead of 'isin'
Posted: Sun Jun 25, 2006 10:57 pm
by Gnafu
ooopppssss....
:lol:
Another hint...
I was thinking that probably you better set a region on the zone you want this script to run and attach that script on EnterScript and LeaveScript
Region TheFantasticZone
{
Range 1500 1500 1700 1700
Guarded 1
EnterText You receive some objects...
LeaveText You lost some objects...
Midi 9
EnterScript :coords:thezone
LeaveScript :coords:thezone
}
So you can also split the script in two (one for entering and one for leaving)
In this case you do not need to set a cprop on the pc
Posted: Mon Jun 26, 2006 6:45 am
by CWO
Thats 096 only though Gnafu for the EnterScript/LeaveScript. I think hes on 095.
Posted: Mon Jun 26, 2006 7:02 am
by Poi
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\pol\scripts>ecompile.exe
EScript Compiler v1.03
Copyright (C) 1994-2003 Eric N. Swanson
Compiling: c:/pol/pkg/teamgates/itemstone.src
Your syntax frightens and confuses me.
Your syntax frightens and confuses me.
Error compiling statement at c:\pol\pkg\teamgates\itemstone.src, Line 2
Parse Error: Waaah!
Near: program itemstone( who )
File: c:\pol\pkg\teamgates\itemstone.src, Line 23
Execution aborted due to: Error compiling file
C:\pol\scripts>
Code: Select all
use uo;
program itemstone( who )
var wpcis:=GetObjProperty(who, "isin");
if(!wpcis) //the cprop does not exists, so the pc is out
var pack1 := who.backpack;
local i;
var temp:=0x99a0; // useless initialization
for (i:=1; i<=7; i:=i+1)
temp:=(0x99a0+i);
CreateItemInContainer (pack1, temp, 1);
endfor
else // the pc is in
var items := EnumerateItemsInContainer(who.backpack);
foreach thing in items
if( (thing.objtype >= 0x99a1) && (thing.objtype <= 0x99a7))
DestroyItem(thing);
endif;
endforeach
EraseObjProperty( who, 'isin' );
endif
endprogram
Posted: Mon Jun 26, 2006 7:35 am
by Gnafu
Poi.... -_-'
there is another 'isin' to change...
the compiler tells you the point where the error is ("..line 23")
@CWO : Yep, I didn't remember which version he's using

Posted: Mon Jun 26, 2006 9:07 am
by Poi
Sorry lmao, i was busy and dint bother to read it, just posted it.
Posted: Mon Jun 26, 2006 9:13 am
by Poi
Ok it still does not work, it creates it over and over no matter how many times you walk thru
Posted: Mon Jun 26, 2006 10:21 am
by Gnafu
:shock:
mmmm, tomorrow i will test it...
*thinking*

Posted: Mon Jun 26, 2006 11:10 am
by Burtonius
add this line before the else statment:
that should fix his script
Posted: Sat Aug 26, 2006 8:13 am
by Poi
Hey thanks alot, sorry it took me so long to get to this, ive been sort of.... uhm anyway, how would i make ti so it deletes it off thier body too?