[Posting] Re: Tequila War 1
From:streu
Thread:Tequila War 1
Forum:Talk
In reply to:Re: Tequila War 1
Date:Tue, 2024-09-24 19:54 GMT

Do you know if there is a script that draws cacti on the map?

None that I know, but this is always an excellent way to invent feature requests.

Just a quick survey:

PCC2's "msgparse.ini" is not good enough to parse this kind of information. It can create markers (and I added the "Cactus" marker shape just for this, long long ago), but it cannot create a marker at a planet, and parsing a list of planet-Ids and cactus types is cumbersome.

For PCC2's "utildata.ini", you can add something like this:

16544,Cactus Score
        h = (-x0000)
        t = Version:
        t = --------
        t = %S32
        t =
        t = Your status:
        t = ------------
        t = Cactuses: %w [built %w]
        t = Score: %w
        t = Vote: %w

16545,Cactus Status
        h = (-p%w)
        t = There is a %2(cactus,foreign stump,exile stump,stump) on planet
        t = %0p (#%0d)

to decode the util.dat messages. But that doesn't give you anything that is not in the normal messages already.

For VPA's "vpa.msg", the original Cactus add-on has this to offer

; *** set cactus
Message Common
Check   1,[MESSAGE FROM CACTUS]
Check   [You set new CACTUS id]
Keep    Square 2
End

; *** capture cactus
Message Common
Check   1,[MESSAGE FROM CACTUS]
Check   [You have captured CACTUS id]
Keep    Square 14
End

; *** lost cactus
Message Common
Check   1,[MESSAGE FROM CACTUS]
Check   [You have lost CACTUS id]
Keep    Square 4
End

; *** destroyed cactus
Message Common
Check   1,[MESSAGE FROM CACTUS]
Check   [You have destroed CACTUS id]
Keep    Square 4
End

; *** CACTUS REF
Message Common
Check   1,[MESSAGE FROM CACTUS REFEREE]
Keep
End

which should be trivial to adapt (but I must admit I never tested that so I cannot tell you what exactly it gives you).

Finally, PCC2 has everything you'd need to implement this as an actual script. But that would have to be a real script with real logic, not just a matter of configuration.

Here's a quick and dirty script that I just came up with, and only rudimentarily tested:

% Quick and dirty cactus support

Sub DrawCactuses
  Local i, p, x, y, me
  ForEach InMsg Do
    If InStr(Text(1), "Cactus Referee") And InStr(Text(3), "Your cactuses") Then
      For i:=4 To Lines Do
        me := Text(i)
        p := Val(Mid(me, 1, 4))
        x := Planet(p).Loc.X
        y := Planet(p).Loc.Y
        If Right(me, 6) = "cactus" Then
          % 7=cactus, 22=bright green, -1=do not save
          NewMarker x, y, 7, 22, "cactus", 0, -1
        Else If Right(me, 5) = "stump" Then
          % 6=blue
          NewMarker x, y, 7, 6, "stump", 0, -1
        Else If Right(me, 7) = "foreign" Then
          % 12=dark green
          NewMarker x, y, 7, 12, "foreign", 0, -1
        Else If Right(me, 5) = "exile" Then
          % 4=red
          NewMarker x, y, 7, 4, "exile", 0, -1
        EndIf
      Next
    EndIf
  Next
EndSub

On Load Do DrawCactuses

To install, save as "cactus.q", and then install as a PCC2 plugin. From the command line: "c2plugin install cactus.q". From the graphical interface: F5 on the startup (game selection) screen, then INS, then choose the file. If you modify the file, just re-install to update.

--Stefan

This is a testing version.
It may be incomplete, and have more bugs (or features) than the public live version at planetscentral.com.