|
Turning off Diagonal, Global string problem Displaying 1-14 of 14 total.
1
Gleznov
|
Hi,
I used to use Verge 1, and I just downloaded and started toying with Verge 3 - I'm excited, it looks like this is THE version of Verge for me! I just have a couple quick questions:
1) How do I disable diagonal walking? In fact, I want more tile-based walking, rather than pixel-accurate. I'm sure there's a basic toggle for this, but I haven't run across it in the docs (or I didn't recognize it if I did). I want old-school FF4/6 style up-down-left-right semi-sluggish movement.
2) All I know to do is describe the problem and see if anyone can shed some light. I have a main map and a town map. Thinking of having more towns later, I figured I'd better add some code to allow me, entering the main map, to know where I came from so I know where to put my char. So in the top of System.vc I added:
string comingFrom;
and in the town's zone-called function to exit to the main map, I added
comingFrom = 'myTownName';
Then in the main map's vc file, I had maped call MapInit as initializing function. MapInit had this:
Log(comingFrom);
If I left it at that, I got 'myTownName' in the log file. But if I added the next part, the compiler crashes out:
if (comingFrom == 'myTownName')
{
// code for spawning player at certain location
}
I also tried:
switch (comingFrom)
{
case 'myTownName':
// code for spawning player at certain location
}
In both cases, I got a crash stating that it 'can't resolve identifier comingFrom'. However if I comment that part out and leave just the Log statement in there, obviously there's a global string comingFrom which = 'myTownName'. So somehow the problem is in the if/switch statements. Am I stupid, or is this some kinda bug?
I changed system.vc to say:
int comingFrom;
and set it to 1 from my first town. It works fine, but I'd much rather use the town/place names in a string than have to remember an integer value for every place you can enter from the main map.
Thanks!
Glez
Posted on 2005-10-12 07:05:21
|
Jesse
|
1) At the moment, this isn't easy. I'll let someone with more experience comment on possible work-arounds.
2) For comparing strings, you want to use strcmp, not ==. switch statements also don't allow strings. I'd suggest using something like:
#define MY_TOWN_NAME 1
#define OTHER_TOWN_NAME 2
and so on, then using the int version of comingFrom.
Hope that helps.
Posted on 2005-10-12 07:20:38
|
Rysen
|
Heya, and welcome back!
1). There's currently no way to toggle to only tile-based movement. You can do it yourself, but it'd take some shifty coding. Unfortunately I don't have any suggestions as I've yet to attempt this myself, but I know others have, so maybe someone else can shed a light on the subject. *cough* RageCage *cough*
2). You can't handle strings the way you would an integer the way you're going about it. You have to use the builtin function strcmp() (the function that 'compares' strings) inside the if statement to use it the way you want. For example:
string comingFrom;
comingFrom = 'myTownName';
if( !strcmp(comingFrom, 'myTownName'))
{
// Code to spawn Character on the right map
}
That will check to see if the string comingFrom is the same as 'myTownName'. strcmp() returns 0 if they end up being the same, and a none 0 value if they are not, so that's why I have '!' in front of it, since we only want the party to spawn on the map if the strings are the same, that is, if strcmp returns 0.
I hope that answers your questions and good luck!
Edit: Ah, Jesse beat me to it and showed a far better way to do something like that, but if you ever need to compare strings for any other reason, at least now you know how. :P
Posted on 2005-10-12 07:27:39 (last edited on 2005-10-12 07:34:05)
|
Gleznov
|
Yes, thank you. That would be easier. I didn't know switches didn't allow strings :/
Another quick question - can you use the get/set song pos command on an .MP3? Here's what's happening:
I stuck two obstructed zoned blocks on my main menu map. One calls one function, the other calls another (adjacent activation). Here are the two functions:
void getMusic()
{
setSongPaused(music,1);
globalvar = getSongPos(music);
setSongPaused(music,0);
}
void restartMusic()
{
stopSong(music);
setSongPos(music, globalvar);
playSong(music);
}
Now when I click on the tile that calls get Music (and throw in a Log command), I see that it does indeed store the music's position in that variable. But when I hit the other tile, which calls restartMusic, no matter what globalvar is, it restarts at the beginning. Am I doing something wrong? Or does MP3 just not carry support for this function?
Glez
Posted on 2005-10-12 08:23:46
|
Omni
|
I made an example of a tile-based modification to Verge in the demos section...it's old and not exactly perfect though...there's one animation glitch I could never get out of it. But it's something to look at if you're interested, maybe it might help you.
If you want to learn to code your own movement system [which isn't...that hard] you'll need to learn the HookRetrace() function, as well as messing with entity variables and reading the controls. It requires some thought but is not difficult to understand.
Posted on 2005-10-12 09:30:53
|
Jesse
|
Quote: Originally posted by Gleznov
Yes, thank you. That would be easier. I didn't know switches didn't allow strings :/
Another quick question - can you use the get/set song pos command on an .MP3?
Yes, you should be able to. Unfortunately, SetSongPos() is broken in the current version of verge. It is fixed in the work-in-progress version, which is not yet public.
Posted on 2005-10-12 09:48:28
|
Gleznov
|
@omni:
Thanks! I'll go check it out.
@Jesse:
How quickly do these guys get patches/upgrades out? I don't really need it right now but it'd be nice to know it'll be soon.
Glez
Posted on 2005-10-12 10:28:02 (last edited on 2005-10-12 10:28:03)
|
Gleznov
|
@Omni:
What is the graphical glitch you mentioned?
Glez
Posted on 2005-10-12 10:45:29
|
Jesse
|
Quote: Originally posted by Gleznov
How quickly do these guys get patches/upgrades out? I don't really need it right now but it'd be nice to know it'll be soon.
There's no set schedule. The current WIP has a couple issues to be resolved, but probably could be released soonish if people want, and the dev team finds the time.
Posted on 2005-10-12 12:29:58
|
Omni
|
Gleznov:
Er...if you don't see a graphical glitch, then I'm happy :) The script I made uses Verge's MoveEntity, and on my computer, if I get bogged down [running lots of programs, etc] the animation becomes quite jerky while walking. Maybe this is a timer problem because of my heavy reliance on MoveEntity, I'm not sure. If you don't notice anything remarkably bad, that's good.
However, as you can tell from the code, the system does have a few drawbacks: you have to code a lot of random things [like zone chances and entity obstructions] into the game yourself, because my code can't read what is in the mapfile.
If I ever redo it I'll probably try to use the native Map Engine completely rather than scripting my own psuedo-substitute...but it was pretty interesting, and if it can help you, or if it gives you an idea of how to code your own system, then excellent.
Posted on 2005-10-13 11:24:03
|
resident
|
I find the new style of movement to be far superior, and can only think of two reasons why someone would want the V1-style. Nostalgia and Block Pushing Puzzles.
Which, admittedly, are two fairly valid reasons. :)
Posted on 2005-10-14 02:18:23
|
Jesse
|
I'd just like to say that I don't think it's useful to spend any more time working on a tile-based movement system in VC.
That is all.
Posted on 2005-10-18 06:21:40
|
mcgrue
|
(innocent whistling...)
Posted on 2005-10-18 10:08:25
|
Omni
|
*gives the eyebrow
Posted on 2005-10-18 10:13:01
|
Displaying 1-14 of 14 total.
1
|
|