The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic script but...
Author Message
Onirim
Journeyman
*

Posts: 64
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jul 2012
Reputation: 0

UO: Rebellion

Post: #1
Basic script but...
It's a very basic script, and unfortunately I've a problem with it.

I've a gump menu for character creation, and I want to put some items on chars with the attribute newbie.

So I've dont that:
Code:
[DIALOG d_creation_class BUTTON]
ON=1050
    DIALOG d_creation_peuple
ON=1051
    if (<SRC.ID> = c_man)
        ITEMNEWBIE=i_shirt_plain
        COLOR=colors_all
        ITEMNEWBIE=random_pants
        COLOR=colors_neutral
        ITEMNEWBIE=random_shoes
        COLOR=colors_neutral
        ITEMNEWBIE=i_dagger
        ITEMNEWBIE=i_candle
        ITEMNEWBIE=i_book_sm
        ITEMNEWBIE=i_gold,1000
    else
        ITEMNEWBIE=i_shirt_plain
        COLOR=colors_all
        ITEMNEWBIE=random_skirt
        COLOR=colors_neutral
        ITEMNEWBIE=random_shoes
        COLOR=colors_neutral
        ITEMNEWBIE=i_dagger
        ITEMNEWBIE=i_candle
        ITEMNEWBIE=i_BOOK_SM
        ITEMNEWBIE=i_gold,1000
    endif
    GO 2153,1837
But when I make choice in the menu, I'm just teleported to my destination, and Sphere telle me
Code:
16:49:ERROR:(creation.scp,367)Undefined keyword 'ITEMNEWBIE'

What the hell ? Big Grin
12-31-2012 02:02 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: Basic script but...
You may find that this is because of the fact that you are creating the character via a gump rather than in the normal way:

From spherewiki
Code:
In any case, this is another file that a lot of questions are asked about. "How do I make players start with 10000 gold?" people ask. Or, "How do I give all blacksmiths 800 ingots?" Now, I'm not saying I would like to play on a shard where you start with 10000 gold or blacksmiths start with 800 ingots. But this file would be the place to do it.

[NEWBIE MALE_DEFAULT]
// Male Generic Starting Clothes
ITEMNEWBIE=i_shirt_plain
COLOR=colors_all
ITEMNEWBIE=random_pants
COLOR=colors_neutral
ITEMNEWBIE=random_shoes
COLOR=colors_neutral
ITEMNEWBIE=i_dagger
ITEMNEWBIE=i_candle
ITEMNEWBIE=i_book_sm
ITEMNEWBIE=i_gold,100

This is what a typical script looks like. It looks kinda like a template doesn't it? Well there's a good reason for that. It really is a template. It just uses the ITEMNEWBIE tag rather than the ITEM tag. Look at the section in Chapter 1 on Templates for more information on how to structure this file!

The only real item of note is that these sections MUST have specific names that the server looks for. You cannot add a new newbie section, no matter how much you'd like to. Sorry!

However a work around would be to create the item and set it's attributes manually

Code:
NEWITEM=i_book_SM
NEW.ATTR=attr_newbie
e.t.c..

Make sure that the items do actually bounce to the player also.

[Image: 2nis46r.jpg]
12-31-2012 02:21 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Onirim
Journeyman
*

Posts: 64
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jul 2012
Reputation: 0

UO: Rebellion

Post: #3
RE: Basic script but...
Thank you very much Smile
I hope this thread can be usefull for all new Sphere scripters (like me, on some ways...)
12-31-2012 02:45 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Onirim
Journeyman
*

Posts: 64
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jul 2012
Reputation: 0

UO: Rebellion

Post: #4
RE: Basic script but...
Damn... I've some other problems with Sphere Script ^^

When a character is created with my creation gump, the character gain a TAG.PEUPLE = something
So I don't want the creation menu open at every connection, and I put this on an player_event script:
Code:
on=@login
if (<TAG0.PEUPLE> == 0)
    DIALOG d_creation
endif
When my TAG.PEOPLE doesn't exist, no problem the creation gump open and the creation occurs.
But when the character have a TAG.PEUPLE = something (ex: Telorien), the script doesn't work and sphere send me:
Code:
08:25:ERROR:(sphere_events_players.scp,335)Undefined symbol 'Telorien'

Why I've an undefined symbol ? I just make a IF on a TAG... no ?
12-31-2012 05:30 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Onirim
Journeyman
*

Posts: 64
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Jul 2012
Reputation: 0

UO: Rebellion

Post: #5
RE: Basic script but...
Okay, the TAG must be a INT, if not, it create an error.
It's strange, TAGs are STRING, but they work only with an INT in a IF :/
12-31-2012 08:29 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #6
RE: Basic script but...
If you just want to check weather the tag is there or not just do
IF !(TAG0.PEUPLE) //<---means if the tag is not there

Sphere can't handle strings in equations

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
01-01-2013 01:09 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #7
RE: Basic script but...
I suspect Ben meant to say: IF !(<TAG0.PEUPLE>)
01-01-2013 01:22 PM
Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #8
RE: Basic script but...
ya, what RanXerox said Smile

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
01-02-2013 06:19 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)