SMBX 1.4.5: Script mistake?

Description: Internal scripting system of SMBX-38A Engine based on the simple VB-like language
Moderators: Lx Xzit, Yoshi021, 5438A38A, Semi-moderatos, Moderators

Kinopiokuppa M
Topic author, Citizen
Citizen
Avatar
Kinopiokuppa M
Topic author, Citizen
Citizen
Age: 24
Reputation: 0
Posts: 6
Joined: 22 Aug 2017
Location: Japan
Twitter

Post #1by Kinopiokuppa » 24 Nov 2019, 6:07

bandicam 2019-11-24 12-02-18-143.mp4 (4.75 MiB) Viewed 328 times

Script:
Score.txt
(249 Bytes) Downloaded 252 times

Lx Xzit M
Moderator
Moderator
Avatar
Lx Xzit M
Moderator
Moderator
Reputation: 402
Posts: 757
Joined: 9 Nov 2015
Website

Post #2by Lx Xzit » 24 Nov 2019, 7:30

For the next time, if you need help with scripts you can go to smbx38a discord server or post at TeaScript subforum. Please use this subforum exclusively for reporting game bugs.

About your code, I see a lot of problems with it.
First, it won't work because you're subtracting ten seconds, so unless you've got the perfect timing (getting the flagpole at a multiplier by ten) it will never take the value of zero. The line "if lvlTimer(Count)=0 then" won't do anything at all since you didn't put instructions inside that block.
Lastly, it won't stop players completely. I don't know why you wanted the player to be still, so my guess is that you only wanted to limit it's walking speed? Anyway, that's not the right way to do it.

I fixed your code:

Code: Select all

do
    if lvltimer(count) > 0 then
        call tcreate([SOUND]Endsound, 0)
        lvltimer(count)-=10
        sysval(score)+=500
        if char(1).xsp > 2 then
            char(1).xsp = 2
        else
            exit do
        end if
        if char(2).xsp > 2 then
            char(2).xsp = 2
        else
            exit do
        end if
    else
        lvltimer(count) = 0
    end if
    call sleep(1)
loop
VISIT MY YOUTUBE CHANNEL! LX XZIT
Join our 38A Discord server!

Image

Kinopiokuppa M
Topic author, Citizen
Citizen
Avatar
Kinopiokuppa M
Topic author, Citizen
Citizen
Age: 24
Reputation: 0
Posts: 6
Joined: 22 Aug 2017
Location: Japan
Twitter

Post #3by Kinopiokuppa » 24 Nov 2019, 10:41

thank you for your answer.
The score only increased by 500.


Return to “TeaScript”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest