SphereCommunity
Basic script but... - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Basic script but... (/Thread-Basic-script-but)



Basic script but... - Onirim - 12-31-2012 02:02 AM

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


RE: Basic script but... - Mordaunt - 12-31-2012 02:21 AM

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.


RE: Basic script but... - Onirim - 12-31-2012 02:45 AM

Thank you very much Smile
I hope this thread can be usefull for all new Sphere scripters (like me, on some ways...)


RE: Basic script but... - Onirim - 12-31-2012 05:30 PM

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 ?


RE: Basic script but... - Onirim - 12-31-2012 08:29 PM

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 :/


RE: Basic script but... - Ben - 01-01-2013 01:09 AM

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


RE: Basic script but... - RanXerox - 01-01-2013 01:22 PM

I suspect Ben meant to say: IF !(<TAG0.PEUPLE>)


RE: Basic script but... - Ben - 01-02-2013 06:19 AM

ya, what RanXerox said Smile