Author Topic: Really quick question: how to skip the first map?  (Read 888 times)

0 Members and 1 Guest are viewing this topic.

Offline As de Espada

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1493
  • Mapper
    • My maps
Really quick question: how to skip the first map?
« on: November 03, 2011, 09:29:19 am »
What I want to do and doesn't work is:
Code: [Select]
procedure ActivateServer();
begin
Command('/nextmap');
end;

I would like to do that without AppOnIddle and without needing to rely on players joining the game if possible.

Why I want to do that? Ahh it's some map checking I want to make, and the first map should be checked also.
All my maps | my latest map: SoldatX Racing Mappack
me making a map on youtube: ctf_FastMade

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Really quick question: how to skip the first map?
« Reply #1 on: November 03, 2011, 03:34:20 pm »
Code: (pascal) [Select]
procedure OnMapChange(NewMap: string);
begin
     if CurrentMap = '' then
          Command('/nextmap');
end;
That's just my guess though, I'm not sure if this will work.

Also, mind making your post's topic more descriptive next time, it's easier for users with similar and same problem to find it trough google or forum's internal search.
« Last Edit: November 03, 2011, 03:52:27 pm by FalconPL »
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline As de Espada

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1493
  • Mapper
    • My maps
Re: Really quick question: how to skip the first map?
« Reply #2 on: November 03, 2011, 04:47:21 pm »
...
thanks, but that doesn't work either. I am currently (also) using:
Code: [Select]
procedure OnMapChange(NewMap: string); 
begin 
    Command('/nextmap'); 
end;
so once the map changes, it changes every time
of course that's just testing. The thing is, the first map is unaffected
guess I'll have to use some timer =/

and sorry about the question being a code. I thought that the topic's name was clear enough.
All my maps | my latest map: SoldatX Racing Mappack
me making a map on youtube: ctf_FastMade

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Really quick question: how to skip the first map?
« Reply #3 on: November 03, 2011, 05:05:38 pm »
Another less-reasonable-than-AppOnIdle method is using threads using ThreadFunc :P Although it may work fine actually since it only runs one time after the server starts, and that is it. I'm not sure. I know others have horrible times with threads, but I only found difficulties when dealing with large-iteration loops in a thread, or calling many threads.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: Really quick question: how to skip the first map?
« Reply #4 on: November 03, 2011, 06:04:50 pm »
since 1.6 it seems to be safe to use threads as long as you don't call functions that trigger events (like DoDamage()) and you don't refer to global variables.
Well, you can kinda complicate my example by parsing the mapslist and checking if current map is in the first line. But that seems like an overwork for the problem.
Why you want to avoid AppOnIdle so much? that seems to be an easiest solution.

* FalconPL hits head against the wall
Code: (pascal) [Select]
var
     justStarted: boolean;

procedure ActivateServer();
begin
     justStarted := true;
end;

procedure OnMapChange(NewMap: string);
begin
     if justStarted then begin
          justStarted := false;
          Command('/nextmap');
     end;
end;

ok, out of curiosity after checking if above snippet works it turned out it still doesn't. Though at this very moment i surrender and officially blame developers.
« Last Edit: November 03, 2011, 06:16:34 pm by FalconPL »
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline As de Espada

  • Soldat Beta Team
  • Veteran
  • ******
  • Posts: 1493
  • Mapper
    • My maps
Re: Really quick question: how to skip the first map?
« Reply #5 on: November 04, 2011, 06:31:50 am »
ok thanks for all the help
I wanted an easier solution than a timer, but I guess I'll use AppOnIdle in the end...
All my maps | my latest map: SoldatX Racing Mappack
me making a map on youtube: ctf_FastMade