Some modifications, please help.

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Damien
Adept Poster
Posts: 82
Joined: Sat Apr 15, 2006 11:50 am

Some modifications, please help.

Post by Damien »

Hello!

I got some problem with my scripts.
In general they are easy ones just that i need some help with some codes which i can't figure out.

Here the first one:

Code: Select all

use uo;
use os;
use basic;
use cfgfile;

include "include/client";
include "include/attributes";
include "equip";

program steedcloak( who, item )
  var newpet;
newpet := CreateNpcFromTemplate("rarehorse", who.x, who.y,who.z);
                                      SetObjProperty(newpet, "master", who.serial);
                                      SetObjProperty(newpet, "prevtamed", 1);
		                              newpet.script := "tamed";
                                      RestartScript(newpet);
SendSysMessage(who, "Wauw! You spawned a Steed :O");
SendSysMessage(who, "You got 15 seconds to get on the mount or else it will die :(");
SendSysMessage(who, "If you ever get off the ride it will automaticlly die.");
sleep(15);

  var val := HandleMods(who, item);
  return val;
endprogram

As you see its not done... my questions are:
As you see, everytime you should unmount the mount you got 15 seconds to get on it again or else it should die and also the "steedcloak" should be destroyed.

DestroyItem(item); is to destroy the "steedcloak" but what code do you use to perma kill the mount if you didnt had time to "get on the horse"
or if you "take off the steedcloak".

The other script looks like this:

Code: Select all

use uo;
use os;
use cfgfile;

include "include/client";
include "include/attributes";
include "equip";

program hidinghat(who, item)

PrintTextAbove(who, "10" , 3 ,38);
sleep(1);
PrintTextAbove(who, "9" , 3 ,38);
sleep(1);
PrintTextAbove(who, "8" , 3 ,38);
sleep(1);
PrintTextAbove(who, "7" , 3 ,38);
sleep(1);
PrintTextAbove(who, "6" , 3 ,38);
sleep(1);
PrintTextAbove(who, "5" , 3 ,38);
sleep(1);
PrintTextAbove(who, "4" , 3 ,38);
sleep(1);
PrintTextAbove(who, "3" , 3 ,38);
sleep(1);
PrintTextAbove(who, "2" , 3 ,38);
sleep(1);
PrintTextAbove(who, "1" , 3 ,38);
sleep(1);
  who.concealed := 1;

  var val := HandleMods(who, item);
  return val;
endprogram
Just a simple script.. BUT when the countdown starts its all going in like 1 second... so when you equip the "hiding hat" it takes 1 second and all text u see is 10, 3, 2 and 1. because of the speed.
How should i do so it takes exacly 1 second from each countdown?

Also when you unquip the "Hiding Hat" you should be revealed.( Very similiar to the question on the "steedcloak" script.

Now for the third one.

Code: Select all

use uo; 

program teasingStone(who, item) 
  var counter := 0;

      case(counter)
        0: PrintTextAbove(item, "Your such a Noobie " + who.name+ ".");
        1: PrintTextAbove(item, "I've got Merchants who looks like you.");
        2: PrintTextAbove(item, who.name + ", Would you like to be my Merchant? HAHAHA");
        3: PrintTextAbove(item, "You little Tramp! Get out of my sight!.");
      endcase
      counter := counter + 1;
endprogram
I want it to show these different text when you click the "TeasingStone".
In general this script are just useless but my point is to know the code so i can use it in other better scripts.

When i click the ball it only shows the first text:
Your such a Noobie " + who.name+ "."

Someone know what to do?

Also one more.
I created some new vendors but when i
create the Merchant ingame i get a error looking like this:
NPC creation failed:Exception detected trying to create npc from template "rareseller":
Error loading NPC's.

And here is the script of my Rareselling merchant...

Npcdesc.cfg

Code: Select all

NpcTemplate RareSeller
{
    Name                   <random> the RareSeller
    script                 merchant
    ObjType                0x190
    Color                  33770
    TrueColor              33784
    Gender                 0
    STR                    200
    INT                    200
    DEX                    200
    HITS                   200
    MANA                   200
    STAM                   200
    Privs                  invul
    Settings               invul
    guardignore            1
    AttackAttribute        Wrestling
    AttackSpeed            80
    AttackDamage           5d100
    dstart                 10
    psub                   25
    alignment              good
    wealth                 upper
    CProp  MerchantType    sRareSeller
    CProp  Equipt          sRareSeller
    AttackHitScript        :combat:wrestlingHitScript
    OpensDoors             1
}
mrcspawn.cfg

Code: Select all

MerchantType  RareSeller
{
    Sells rares
    Buys  rares
}
and

Code: Select all

ProductGroup rares
{
    Item    0x9017 5 //SteedCloak
    Item    0x9015 5 //InfernalRobe
    Item    0x9013 5 //TeasingStone
    Item    0x9005 10 //GodlyExplosionPot
    Item    0x8021 5 //Fragstone
    Item    0x8023 5 //Hidinghat
}
and then we got npcequip :/ dont think that makes the error ;p

Code: Select all

NpcTemplate rareseller
{
    Equipt    RareSeller
}

Someone know what creates the Error? :O

That is all for now, im sure more is coming ;P

I would appreciate if someone could help :D and sorry for my english.

Code: Select all

Thanks.
Xadhoom
Neophyte Poster
Posts: 30
Joined: Fri May 26, 2006 12:53 am

Post by Xadhoom »

To kill the mount use
ApplyRawDamage( mount, GetHp(mount) );

sleep(1) means "stop the script for 1 second" but the equip script runs as critical script so ignores sleep. You must use Start_script when you equip the hat, and set in the new script the countdown.
In the unequip script of the hat simply use who.concealed := 0;

For the third script use:
counter := RandomInt(4); and delete counter := counter +1;

In the npcdesc of the merchant i think it's missing Graphic
Aeros
Journeyman Poster
Posts: 69
Joined: Mon Apr 24, 2006 10:56 am

Post by Aeros »

By the way, may I suggest you change this:

Code: Select all

PrintTextAbove(who, "10" , 3 ,38);
sleep(1);
PrintTextAbove(who, "9" , 3 ,38);
sleep(1);
PrintTextAbove(who, "8" , 3 ,38);
sleep(1);
PrintTextAbove(who, "7" , 3 ,38);
sleep(1);
PrintTextAbove(who, "6" , 3 ,38);
sleep(1);
PrintTextAbove(who, "5" , 3 ,38);
sleep(1);
PrintTextAbove(who, "4" , 3 ,38);
sleep(1);
PrintTextAbove(who, "3" , 3 ,38);
sleep(1);
PrintTextAbove(who, "2" , 3 ,38);
sleep(1);
PrintTextAbove(who, "1" , 3 ,38);
sleep(1);
  who.concealed := 1;
To:

Code: Select all

var i;
for(i := 10; i >= 1; i := i - 1)
	PrintTextAbove(who,i,3,38);
	sleep(1);
endfor
who.hidden := 1;
Few things I changed there: Firstly, it hides the character, not conceal it. Player should be hidden, staff should be concealed. Secondly, I used a for loop - just a more optimised way of doing it, as well as better scripting methodology.
Damien
Adept Poster
Posts: 82
Joined: Sat Apr 15, 2006 11:50 am

Post by Damien »

Hello Thanks.

But i still got some problems with Steedcloak and that Counter...

This is how i changed my counter:

Code: Select all


use uo; 

program teasingStone(who, item) 

  var counter := RandomInt(4);
      case(counter)
        1: PrintTextAbove(item, "Your such a Noobie " + who.name+ ".");
        2: PrintTextAbove(item, "I've got Merchants who looks like you.");
        3: PrintTextAbove(item, who.name + ", Would you like to be my Merchant? HAHAHA");
        4: PrintTextAbove(item, "You little Tramp! Get out of my sight!.");
      endcase
      counter := counter + 1;
return val;
endprogram
and the Error is:

Code: Select all

Compiling: I:/Program/Robin/Nya  Pol/pkg/stenar/teasingstone.src
Token '(' cannot follow token 'RandomInt'
Function RandomInt() is not defined.
Error compiling statement at I:\Program\Robin\Nya  Pol\pkg\stenar\teasingstone.s
rc, Line 6
Error detected in program body.
Error occurred at I:\Program\Robin\Nya  Pol\pkg\stenar\teasingstone.src, Line 6
Execution aborted due to: Error compiling file
Am i totally braindead because i cant see anything wrong :S

The second one, the steedcloak.
This is what i changed it too:

Code: Select all

use uo;
use os;
use basic;
use cfgfile;

include "include/client";
include "include/attributes";
include "equip";

program steedcloak( who, item )
  var newpet;
newpet := CreateNpcFromTemplate("rarehorse", who.x, who.y,who.z);
                                      SetObjProperty(newpet, "master", who.serial);
                                      SetObjProperty(newpet, "prevtamed", 1);
		                              newpet.script := "tamed";
                                      RestartScript(newpet);
SendSysMessage(who, "Wauw! You spawned a Steed :O");
SendSysMessage(who, "You got 15 seconds to get on the mount or else it will die :(");
SendSysMessage(who, "If you ever get off the ride it will automaticlly die.");
sleep(15);
if(who)
var mount := GetEquipmentByLayer( who, 25 ); 
else
ApplyRawDamage( mount, GetHp(mount) ); 
destroyitem(steedcloak);
endif
  var val := HandleMods(who, item);
  return val;
endprogram
and the Error is:

Code: Select all

Compiling: I:/Program/Robin/Nya  Pol/pkg/systems/combat/steedcloak.src
Warning: local variable 'mount' not used.
File: I:\Program\Robin\Nya  Pol\pkg\systems\combat\steedcloak.src, Line 22
Variable mount has not been declared on line 24.
Error compiling statement at I:\Program\Robin\Nya  Pol\pkg\systems\combat\steedc
loak.src, Line 24
Error compiling statement at I:\Program\Robin\Nya  Pol\pkg\systems\combat\steedc
loak.src, Line 21
Error detected in program body.
Error occurred at I:\Program\Robin\Nya  Pol\pkg\systems\combat\steedcloak.src, L
ine 24
Execution aborted due to: Error compiling file
what variable should i put in? :O :(

Please help me :)

Code: Select all

Thanks.
Xadhoom
Neophyte Poster
Posts: 30
Joined: Fri May 26, 2006 12:53 am

Post by Xadhoom »

you must set at the beginning of the teasingstones

use util;


in the second file, you have defined a variable (mount) inside an if statement, so when you exit the if it doesn't exists anymore
anyway it is incorrect, it must look like this:

use uo;
use os;
use basic;
use cfgfile;

include "include/client";
include "include/attributes";
include "equip";

program steedcloak( who, item )

if(!ReserveItem( who, item ))
return;
endif

var newpet := CreateNpcFromTemplate("rarehorse", who.x, who.y, who.z );
SetObjProperty(newpet, "master", who.serial);
SetObjProperty(newpet, "prevtamed", 1);
newpet.script := "tamed";
RestartScript(newpet);

SendSysMessage(who, "Wauw! You spawned a Steed :O");
SendSysMessage(who, "You got 15 seconds to get on the mount or else it will die :(");
SendSysMessage(who, "If you ever get off the ride it will automaticlly die.");
sleep(15);

ReleaseItem(item);

ApplyRawDamage( newpet, GetHp(newpet) );

if(!who || !GetEquipmentByLayer( who, LAYER_MOUNT ))
return;
endif

DestroyItem(item);

//i don't know what is this :P
return HandleMods(who, item);

endprogram


And you should add a script when the player dismounts that kills the pet and recreates the steedcloak
Damien
Adept Poster
Posts: 82
Joined: Sat Apr 15, 2006 11:50 am

Post by Damien »

Thanks.

One script i cant understand..
This is familiar to it:
http://forums.polserver.com/viewtopic.php?t=331

I want to create a "WebpageStone" which do open a webpage when ur clicking on the stone and if someone want to help me it would be great!

And btw my new merchants, the PlantSeller Works but not the RareSeller.
When i write buy near my RareSeller i get client crash:O ?

a feeling sais me i need to change something in my uo folder, am i right?


Code: Select all

Thanks.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

Make sure you can see all the items hes selling without crashing. If you can, go back and make sure your entries for the items are correct. An invalid graphic can cause crashes. The client sometimes does have its ways too where you have to reinstall to see the simplest of things.

as for opening a webpage, this post should help you...

http://forums.polserver.com/viewtopic.php?t=331

I think the include with that code comes with distro, if not, its there on the post for you. All you would need to do is to make a usescript for the stone to use that function and a webpage to whatever you want can be opened.
Post Reply