Aller au contenu

Photo

Script for Activating Pin on World Map help needed


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
Sonmeister

Sonmeister
  • Members
  • 167 messages
I've written my script to activate my world map pin on a plot event.  When I compile it says "Parsing variable list" on line 9 which is the "void main () line."  Can someone look this over and tell me what's up?  I'm also not sure if I have the const string and everything else how it should be.



#include "plot_h"
#include "utility_h"
#include "wrappers_h"

#include "plt_ancient_elven_ruins"

const string MY_RUINS_PIN = "my_ruins_map2"

void main()
{
    // deconstruct event
    event evCurrent = GetCurrentEvent();
    int nEventType = GetEventType(evCurrent);
    int nPlotFlag = GetEventInteger(evCurrent, 1);

    // common
    object oHero = GetHero();

    switch(nEventType)
    {
        case EVENT_TYPE_SET_PLOT:
        {
            int nNewValue = GetEventInteger(evCurrent, 2);  // value to be assigned
            int nOldValue = GetEventInteger(evCurrent, 3);  // value currently assigned

            switch(nPlotFlag)
            {
                case SENT_TO_DWARF:
                {
                    // Activate way point
                    object oMapPinRoad = GetObjectByTag("my_ruins_map2")
                    WR_SetWorldMapLocationStatus(GetObjectByTag(MY_RUINS_PIN), WM_LOCATION_ACTIVE);

                    break;
                }
                case FOUND_DWARF:
                {
                    break;
                }
            }
            break;
        }
    }
}

#2
Craig Graff

Craig Graff
  • Members
  • 608 messages
Note the ";" below:
const string MY_RUINS_PIN = "my_ruins_map2";

Also, you should probably use the constant that you declared in the body of the script (MY_RUINS_PIN instead of "my_ruins_map2"). Also, using the object that you declared would be good. The script should basically look like this:
[dascript]
#include "plot_h"
#include "utility_h"
#include "wrappers_h"

#include "plt_ancient_elven_ruins"

const string MY_RUINS_PIN = "my_ruins_map2";

void main()
{
    // deconstruct event
    event evCurrent = GetCurrentEvent();
    int nEventType = GetEventType(evCurrent);
    int nPlotFlag = GetEventInteger(evCurrent, 1);

    // common
    object oHero = GetHero();

    switch(nEventType)
    {
        case EVENT_TYPE_SET_PLOT:
        {
            int nNewValue = GetEventInteger(evCurrent, 2);  // value to be assigned
            int nOldValue = GetEventInteger(evCurrent, 3);  // value currently assigned

            switch(nPlotFlag)
            {
                case SENT_TO_DWARF:
                {
                    // Activate way point
                    object oMapPinRoad = GetObjectByTag(MY_RUINS_PIN);
                    WR_SetWorldMapLocationStatus(oMapPinRoad, WM_LOCATION_ACTIVE);

                    break;
                }
                case FOUND_DWARF:
                {
                    break;
                }
            }
            break;
        }
    }
}
[/dascript]

Modifié par Craig Graff, 31 mai 2010 - 12:33 .


#3
Sonmeister

Sonmeister
  • Members
  • 167 messages
Thanks Craig. I often get my constants and objects mixed and find myself having this issue. It's good to have some other eyes look things over.



Why is it that sometimes you need the extension and sometimes you don't when you make constants references for tags? (ie. .dlg, .utc., .itc.)

#4
Craig Graff

Craig Graff
  • Members
  • 608 messages
You never need the extension for tags, but you always need it for resources.

#5
Sonmeister

Sonmeister
  • Members
  • 167 messages
OK, I'll remember that. Thanks.   BTW, the script worked like a charm.

Modifié par Sonmeister, 31 mai 2010 - 02:00 .